Revision history [back]

click to hide/show revision 1
initial version

asked 2013-06-07 00:02:38 +0800

phasthal gravatar image phasthal

invoke custom functions

I have created a custom function (to add the values from the given range), but this method is never getting invoked and not even throws any exception. What could be the wrong?

public static double addRange(Range r1, Range r2){
    // logic goes here
    System.out.println("adding ranges");        
    return 1.00;
}

Where as, when I tried this below function, which is getting invoked and working fine.

public static int add(int l, int m){
        System.out.println("addition");
        return l*m;
}

and my zul file is

<?page title="ZSS" contentType="text/html;charset=UTF-8"?>
    <?xel-method prefix="zss" name="add"
        class="org.zkoss.zssessentials.functions"  
        signature="int add(int, int)"?>
    <?xel-method prefix="zss" name="addRange"
        class="org.zkoss.zssessentials.functions"  
        signature="double addRange(org.zkoss.zss.model.Range, org.zkoss.zss.model.Range)"?>         
    <zk>
        <window title="ZSS User Defined Functions as Java static method" border="normal"
            width="100%" height="100%">
            <spreadsheet width="800px" height="800px"
                src="/WEB-INF/customfunctions.xlsx" maxrows="20" maxcolumns="10">
            </spreadsheet>
        </window>
    </zk>

invoke custom functions

I have created a custom function (to add the values from the given range), but this method is never getting invoked and not even throws any exception. What could be the wrong?

public static double addRange(Range r1, Range r2){
    // logic goes here
    System.out.println("adding ranges");        
    return 1.00;
}

Where as, when I tried this below function, which is getting invoked and working fine.

public static int add(int l, int m){
        System.out.println("addition");
        return l*m;
}

and my zul file is

<?page title="ZSS" contentType="text/html;charset=UTF-8"?>
    <?xel-method prefix="zss" name="add"
        class="org.zkoss.zssessentials.functions" class="org.zkoss.zssessentials.functions.CustomFunction"  
        signature="int add(int, int)"?>
    <?xel-method prefix="zss" name="addRange"
        class="org.zkoss.zssessentials.functions" class="org.zkoss.zssessentials.functions.CustomFunction"  
        signature="double addRange(org.zkoss.zss.model.Range, org.zkoss.zss.model.Range)"?>         
    <zk>
        <window title="ZSS User Defined Functions as Java static method" border="normal"
            width="100%" height="100%">
            <spreadsheet width="800px" height="800px"
                src="/WEB-INF/customfunctions.xlsx" maxrows="20" maxcolumns="10">
            </spreadsheet>
        </window>
    </zk>

invoke custom functions

I have created a custom function (to add the values from the given range), but this method is never getting invoked and not even throws any exception. What could be the wrong?

public static double addRange(Range r1, Range r2){
    // logic goes here
    System.out.println("adding ranges");        
    return 1.00;
}

Where as, when I tried this below function, which is getting invoked and working fine.

public static int add(int l, int m){
        System.out.println("addition");
        return l*m;
}

and my zul file is

<?page title="ZSS" contentType="text/html;charset=UTF-8"?>
    <?xel-method prefix="zss" name="add"
        class="org.zkoss.zssessentials.functions.CustomFunction"  
        signature="int add(int, int)"?>
    <?xel-method prefix="zss" name="addRange"
        class="org.zkoss.zssessentials.functions.CustomFunction"  
        signature="double addRange(org.zkoss.zss.model.Range, org.zkoss.zss.model.Range)"?>         
    <zk>
        <window title="ZSS User Defined Functions as Java static method" border="normal"
            width="100%" height="100%">
            <spreadsheet width="800px" height="800px"
                src="/WEB-INF/customfunctions.xlsx" maxrows="20" maxcolumns="10">
            </spreadsheet>
        </window>
    </zk>
Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More