volosoft / jtable

A JQuery plugin to create AJAX based CRUD tables.
http://www.jtable.org
1.1k stars 506 forks source link

Error in passing function to API: options #1172

Open opetrone opened 10 years ago

opetrone commented 10 years ago

If I pass a function to options the dropdown menu don't work (no ajax request launched if I pass a url).

Example:

FIELD: { title: 'Comune', dependsOn: 'FIELD_TOP', if (data.source == 'list') { return 'action/comuni.php?province=?provincia=0'; } return 'action/comuni.php?province=?provincia=' + data.dependedValues.COD_ISTAT_PROV; } },

hikalkan commented 10 years ago

Check, your code is invalid. You did not define function.

PhoneType: {
    title: 'Phone type',
    options: function(data) {
        if (data.source == 'list') {
            //Return url all options for optimization. 
            return '/Demo/GetPhoneTypes.php?UserType=0';
        }

        //This code runs when user opens edit/create form to create combobox.
        //data.source == 'edit' || data.source == 'create'
        return '/Demo/GetPhoneTypes.php?UserType=' + data.record.UserType;
    }
}

Also, COD_ISTAT_PROV is not set in dependsOn.