transport - Kendo UI does not call create if a function is specified -
using kendo.web.js versions 2013.2.716 , 2012.3.1315, trying use function in transport.create rather calling url. find function not called. instead default url called , resulting html appears cause error in bowels of kendo because expected json instead.
i assume type of configuration error, can't figure out problem is.
here snippet of code:
var clientlistds = new kendo.data.datasource({ transport: { read: { url: window.baseurl + 'healthcheck/clientsummary', datatype: 'json', type: 'post' }, create: function(a,b,c) { alert('create'); }, createy: window.baseurl + 'healthcheck/dontcallme', createx: { url: window.baseurl + 'healthcheck/dontcallme', datatype: 'json', type: 'post' }, whatwewantcreatetodo: function () { showchoosedialog('some random string', 'select client', onrefreshinactiveclientlist); }, destroy: function () { alert('destroy'); }, update: function () { alert('update'); } }, autosync: true, schema: { model: { id: 'id', fields: { id: { required: false, type: 'number', nullable: true }, clientname: { type: 'string' }, clienttag: { type: 'string' }, status: { type: 'string' } } } } });
then use resulting data source build grid this:
$('#cclientgrid').kendogrid({ datasource: clientlistds, columns: [ { field: 'clienttag', title: 'tag'}, { field: 'clientname', title: 'name' }, { field: 'status' } ], editable: { mode: 'incell', createat: 'bottom' }, edit: function (pevent) { if (pevent.model.isnew()) alert('create'); else alert('edit'); }, toolbar: ['create'] });
some behavior worthy of note:
- you see several attempts @ create configuration. if use createy or createx, call resulting url. if use create or whatwewantcreatetodo, end downloading containing page each element of schema string items (i assume type of default behavior can't find reference url downloaded).
- when turn off autosync, grid call edit function when use toolbar create new item. when turn on autosync, edit function not called. instead data source create functionality runs.
any thoughts or insight on how might able call function instead of url appreciated.
first make in transport
being url or function, not mix them up.
if need implement read
function, do:
transport: { read : function (options) { $.ajax({ url: window.baseurl + 'healthcheck/clientsummary', datatype: 'json', type: 'post', success : function (result) { options.success(result); } }); },
Comments
Post a Comment