How to use "e" parameter of endEdit method? Documentation says:
.igGridUpdating( "endEdit", [update:bool], [e:object] );
Hello Luis,
This particular event is provided to end the row editing manually (when the row is putted in edit mode). In order to handle the event which is raised after that method you can handle editCellEnded/Ending or editRowEnded/Endind depends if you are using cell or row editing type.
Thanks Kolev, I understand what the method (not event) does but not how to use its parameter "e", could you bring an example of how to use it? what are the benefits of that parameter? I think there is a lack of information in this regard in the documentation, maybe I am wrong. Thanks again ;)
Sorry Kolev and please be patient with me, I am not good at jQuery or JavaScript (yet), I think you don't understand my question or I am not explaining properly. I already know what the "update" parameter does, I am stuck with parameter "e", I don't know what kind of object should be passed to this parameter to do who knows what. If I pass "true" to parameter "update" it will update the grid with new values as it is declared in the documentation, but if I pass an object to paramter "e" what will happen? The documentation says "events are rised", Which events? If I have something like:
var myObject = new Object();
$("#grid").igGridUpdating("endEdit", true, myObject);
"#grid"
).igGridUpdating(
"endEdit", true, myObject
);
What will igGridUpdating does? It would be easier for me if you proived a simple example. Thanks.
Hello,
Yes, your assumption is correct, you can pass myObject to the event handler argument and access it later in editCellEnded event (which will be fired because you are passing true like a second parameter).
Code snippet:
<script> var data = [ { "ID": 1, "Name": "John Smith", "Age": 45 }, { "ID": 2, "Name": "Mary Johnson", "Age": 32 }, { "ID": 3, "Name": "Bob Ferguson", "Age": 32 }, ];
$(function () { $("#grid").igGrid({ primaryKey: "ID", dataSource: data, //JSON Array defined above features: [ { name: "Updating", enableAddRow: true, editMode: "cell", enableDeleteRow: false, enableAddRow: false, editCellEnded: function(evt, ui){ alert("editCellEnded");
//evt.originalEvent will return you the object } } ] }); }); function StartEdit() { $("#grid").igGridUpdating("startEdit", 1, 1); } function EndEdit() { var car = { type:"VW Golf", model: 4, color: "silver"}; $("#grid").igGridUpdating("endEdit", true, car); } </script>
Let me know if I may be of further assistance.
Thank you so much Kolev!!! now is crystal clear to me :) This is the kind of documentation I need it.
I am glad to hear that you find my reply helpful.
Thank you for using our products.
this example the event editCellEnded does not fire when working with new row