This question is locked. New answers and comments are not allowed.
I have the following bound to the OnDataBinding event of a grid to check if changes have been saved before refreshing:-
If I create a grid with the following ToolBar, it works fine:-
However if I use a template (so I can include other things in the tool bar):-
I get a "Object doesn't support this property or method" error on grid.hasChanges(), despite the grid working fine, and the save/cancel changes buttons working as expected.
Is there something in the ToolBar SubmitChanges() extension that adds the hasChanges method to the grid?
function OnDataBinding(e) { var grid = $(this).data("tGrid"); if (grid.hasChanges()) { if (!confirm("You are going to lose any unsaved changes. Are you sure?")) { e.preventDefault(); } }}If I create a grid with the following ToolBar, it works fine:-
.ToolBar(commands =>{ commands.SubmitChanges();})However if I use a template (so I can include other things in the tool bar):-
.ToolBar(commands =>{ commands.Template(@<text> <a class="t-button t-grid-save-changes" href="#">Save Changes</a> <a class="t-button t-grid-cancel-changes" href="#">Cancel Changes</a> @Html.ActionLink("Commit", "Commit", new { id = Model.Id }, new { @id = "buttonCommit", @class = "t-button", @style = "display: none;" }) </text>);})I get a "Object doesn't support this property or method" error on grid.hasChanges(), despite the grid working fine, and the save/cancel changes buttons working as expected.
Is there something in the ToolBar SubmitChanges() extension that adds the hasChanges method to the grid?