Note that there are some explanatory texts on larger screens.

plurals
  1. POKendo Grid handling create/delete errors with popup editor
    primarykey
    data
    text
    <p>I have a kendo grid that does a create/delete, both of them ending with errors. I would like to:.</p> <ol> <li>When having an error on delete to prevent the row deleting from the grid (that is the default behavior when having errors)</li> <li>When having a create error to prevent the popup editor to close</li> </ol> <p>Please see this fiddle: <a href="http://jsfiddle.net/andreigavrila/p49eV/2/" rel="nofollow">http://jsfiddle.net/andreigavrila/p49eV/2/</a></p> <pre class="lang-js prettyprint-override"><code>var data = [ { Id: 1, Name: "Decision 1", Code: 1 }, { Id: 2, Name: "Decision 2", Code: 2 }, { Id: 3, Name: "Decision 3", Code: 3 } ]; $("#grid").kendoGrid({ dataSource: { error: function (a) { console.log('error'); $('#grid').data("kendoGrid").cancelChanges(); //$('#grid').data("kendoGrid").one("dataBinding", function (e) { //e.preventDefault(); // cancel grid rebind //}); }, transport: { read: function(e) { e.success({data: data}); }, create: function(e) { console.log('creating'); e.error(); }, destroy: function(e) { console.log('deleting') e.error(); } }, schema: { data: "data", model: { id: "Id", fields: { Id: { type: "number" }, Code: { type: "number" }, Name: { type: "string" } } } } }, toolbar: ["create"], columns: [ { field: "Code", title: "Code", }, { field: "Name", title: "Name" }, { command: ["destroy"], title: "&amp;nbsp;" }], editable: { mode: "popup" } }); </code></pre> <p>The second point works by default (so having an error on create does not close the popup)</p> <p>The first point works by adding the error function, but that breaks the popup (it closes on error).</p> <p>So I can have either one of my , but not both in the same time. I am kind of stuck. I also saw this 2 questions on kendo forums:</p> <ul> <li><a href="http://www.kendoui.com/forums/kendo-ui-complete-for-asp-net-mvc/grid/deleted-row-removed-from-grid-even-though-errors-returned-in-destroy-method.aspx" rel="nofollow">delete error</a> </li> <li><a href="http://www.kendoui.com/forums/kendo-ui-framework/mvvm/handling-validation-errors-from-server-in-kendo-grid.aspx" rel="nofollow">server validation</a></li> </ul> <p>The second link said "to prevent the Grid from closing you need to prevent the next dataBinding event." but i can't make that work.</p> <p>Thank you for your help.</p> <p>Andrei</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload