javascript - KendoGrid paging has "undefined" and "NaN" -
this question has answer here:
presently attempting add paging kendo grid. here full error message:
error in event handler (unknown): typeerror: cannot read property 'url' of null @ object.tinyfilter.start (chrome-extension://nlfgnnlnfbpcammlnibfkplpnbbbdeli/site.js:61:43) @ chrome-extension://nlfgnnlnfbpcammlnibfkplpnbbbdeli/site.js:137:16
here code in controller:
public actionresult executerule(string ruleid, string rulesql, list<matchruleparam> parameters = null) { if (request.url != null) { var query = paginationquery.parse(request.querystring); var upperlimit = query.fromupper; var lowerlimit = query.fromlower; var datasource = new matchdatasource(); var results = datasource.executetestrule(ruleid, rulesql, parameters, upperlimit, lowerlimit).select(k => new { key = k }); var response = new dictionary<string, object>(); response["result"] = results; response["rowcount"] = matchdatasource.getrowcount(ruleid, rulesql, parameters); return json(response, jsonrequestbehavior.allowget); } return null; }
when try put breakpoint in chrome on url line below, not stop in javascript function:
function execrule() { $.ajax({ type: 'post', url: "executerule", contenttype: 'application/json; charset=utf-8', data: json.stringify({ ruleid: pagestate.selected.ruleid, rulesql: pagestate.sqleditor.rulesql.getvalue(), parameters: pagestate.ruleparameters }), schema: { errors: function(response) { return response.error; }, data: function(response) { return response.result; }, total: function(response) { return response.rowcount; } }, success: function(matchedlist) { pagestate.ruleresult = matchedlist.result; var datasource = new kendo.data.datasource({ data: matchedlist.result }); grids.ruleresultsgrid.setdatasource(datasource); pagestate.selected.childkey = null; updatebuttonstates(); }, error: function(e) { var errorobject = json.parse(e.xhr.responsetext); var errormessage = errorobject.message; //clear old error message //todo: gridwidget.clearerrormessage("error-message"); // add new error message //todo: gridwidget.adderrormessage("error-message", errormessage); }, pagesize: 10, requestend: this.onrequestend });
the code works properly, except reason kendo grid has "undefined" , "nan" have put red boxes around highlight in image:
the error happens open web page. have suggestions why receiving typeerror? tia.
update:
the "undefined" , "nan" issue has been resolved, can select various pagesize values, when grid refresh stuck value "10." why occurring?
had put pagesize in data source:
function execrule() { $.ajax({ type: 'post', url: "executerule", contenttype: 'application/json; charset=utf-8', data: json.stringify({ ruleid: pagestate.selected.ruleid, rulesql: pagestate.sqleditor.rulesql.getvalue(), parameters: pagestate.ruleparameters }), schema: { errors: function(response) { return response.error; }, data: function(response) { return response.result; }, total: function(response) { return response.rowcount; } }, success: function(matchedlist) { pagestate.ruleresult = matchedlist.result; var datasource = new kendo.data.datasource({ pagesize: 10, data: matchedlist.result }); grids.ruleresultsgrid.setdatasource(datasource); pagestate.selected.childuwi = null; updatebuttonstates(); }, error: function(e) { var errorobject = json.parse(e.xhr.responsetext); var errormessage = errorobject.message; //clear old error message grids.ruleresultsgrid.clearerrormessage("error-message"); // add new error message grids.ruleresultsgrid.adderrormessage("error-message", errormessage); }, }); }
found solution here: pager error in kendo grid(nan-nan of 1 items)
that said, paging not accept different page sizes, say, of 10, 50, 100 or 500. can select values, defaults 10 value in execrule function. have suggestions why happening?
update:
fixed problem paging updating binding function include pagesize:
function bindruleresults() { pagestate.selected.old.ruleresult = pagestate.selected.ruleresult; var datasource = new kendo.data.datasource({ pagesize: 10, data: pagestate.selected.ruleresult }); grids.ruleresultsgrid.setdatasource(datasource); pagestate.selected.ruleresult = null; }
found useful article: http://www.codeproject.com/articles/606682/kendo-grid-in-action
Comments
Post a Comment