Kendo Grid - In Firefox triggering an alert in the save event causes a page reload -
i want know if has seen this. have kendo grid , in save event, want validation. make sure new values difference between old less or equal balance.
so if greater balance, trigger alert , preventdefault. displaying alert causes page reload in firefox.
here grid:
$("#gridopeninvoices").kendogrid({ autobind: false, datasource: openinvoicesdata, scrollable: true, sortable: false, navigatable: true, toolbar: [{name:"save", text:strings.applyupdates}, {name: "splitpayment", text: strings.splitpayment}, {name: "paidout", text: strings.paidout}, {name: "createcredit", text: strings.creditbalance}, {name: "undoallocation", text: strings.undoallocation}], columns: [ { field: "customername", title: strings.accountname, hidden: true }, { field: "opentransactionid", title: strings.opentransaction, width:90 }, { field: "invoicenumber" , title: strings.invoicenumber, width:65 }, { field: "grosssales", title: strings.originalamount, width: 75, format: "{0:c}", decimals: 2, min: 1, value: 0 }, { field: "balance", title: strings.transbalance, width: 75, format: "{0:c}", decimals: 2, min: 1, value: 0 }, { field: "date", title: strings.date, width:75, format: "{0:mm/dd/yy}" }, { field: "age", title: strings.age, width:55 }, { field: "checknumber", title: strings.checknumber, width:85 }, { title: strings.applypayment, width:75, template: "<input class='k-chk-applied chkbox' type='checkbox' data-bind='source: isapplied' name='isapplied' #= isapplied ? 'checked' : ''#/>", attributes:{"class":"tdisapplied"} }, { field:"appliedamount", title: strings.appliedamount, format: "{0:c}", width: 95, attributes: {"class" : "tdappliedamount"} }], save: function(e) { var model = e.model; if (e.values.appliedamount != null) { var remainingbalance = context.getremainingbalance(); var difference = e.values.appliedamount - model.appliedamount; if (remainingbalance >= difference) { var balancecopy = model.balancecopy; model.balance = model.grosssales - e.values.appliedamount; model.balancecopy = model.grosssales - e.values.appliedamount; if (model.balance == 0 && model.isuncollected) { model.isuncollected = false; context.updatebalance(balancecopy, 0, true); } context.updatebalance(model.appliedamount, e.values.appliedamount, true); this.refresh(); context.showbuttons(); } else { alert("the applied amount exceeds remaining balance"); e.preventdefault(); } } }, editable:"incell"}); this seems happening when edit applied amount , hit enter commit. idea of why happening?
the solution simple: not use alert.
i have same problem in events in kendoui widgets. if need display user, use kendowindow it's modal property set true.
alerts should used debugging purposes, console.log.
Comments
Post a Comment