In my project I want to display the popup while clear the kendo-grid by clicking "button" but I am getting SyntaxError: Unexpected token ILLEGAL error occurred in browser debug
Here is my code:
function Filter() {
$("#loading-msg").data("kendoWindow").center().open();
$("form.k-filter-menu button[type='reset']").trigger("click");
$("#loading-msg").data("kendoWindow").center().close();
}
Where I am wrong? Why I am getting this error?
My fiddle.
Like other programming languages, JavaScript has define some proper programming rules. Not follow them throws an error.An unexpected token occurs if JavaScript code has a missing or extra character { like, ) + – var if-else var etc}. Unexpected token is similar to syntax error but more specific.
Syntax Error – This error is caused by an error in the PHP structure when a character is missing or added that shouldn't be there. Unexpected – This means the code is missing a character and PHP reaches the end of the file without finding what it's looking for.
To solve the "Uncaught SyntaxError: Unexpected identifier" error, make sure you don't have any misspelled keywords, e.g. Let or Function instead of let and function , and correct any typos related to a missing or an extra comma, colon, parenthesis, quote or bracket.
Instead of executing the close just after issuing the filter. My recommendation is closing the window on DataSource requestEnd event.
I.e.: Clear filter:
function clearFiter() {
$("#loading-msg").data("kendoWindow").center().open();
$("#grid").data("kendoGrid").dataSource.filter([]);
}
and DataSource:
dataSource: {
type: "odata",
transport: {
read: "http://demos.kendoui.com/service/Northwind.svc/Orders"
},
schema: {
model: {
fields: {
OrderID: { type: "number" },
Freight: { type: "number" },
ShipName: { type: "string" },
OrderDate: { type: "date" },
ShipCity: { type: "string" }
}
}
},
pageSize: 10,
serverPaging: true,
serverFiltering: true,
serverSorting: true,
requestEnd : function () {
$("#loading-msg").data("kendoWindow").close();
}
},
Your code modified here : http://jsfiddle.net/OnaBai/MG89G/595/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With