javascript - jqGrid row(s) deletion -


I have used a button that is used to delete a single row, so that the call is created Call 'delRowData'. Unless you want to delete the rows / row of multiple rows (unless the builtin variable 'Celero' is simple enough) does anyone have a better answer than the terrible mess (like modify the core jqGrid code) ??

Here is my code:

 $ ("# deleteButton"). Click (function () {var gr = jQuery ("# ​​myGrid"). JqGrid ('getGridParam', 'Selarrrow'); var su = jQuery ("# ​​myGrid"). JqGrid ('delRowData', Gr.toString ()); (su)? '': Warning ("has already been deleted or not in the list");});  

And now to modify the main code in jquery.jqGrid.min.js, actually for the bad part:

  delRowData: function (f) {for (var M = 0, max = f.length; m & lt; max; m ++) {var j = false, i, c; This.each (function () {var e = this; if (i = E. Roses; nimit (f [m])) {b (i) .remove (); eprecords--; epreccount--; e .updatepager (True, false); j = true; if (epmultiselect) {c = b.inArray (F [M], apeslero); C! = - 1 & amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; into ছবি; (c, 1)} == "undefined") (ifof = k == "local") {Epdata.splice (k, 1); e.refreshIndex ()}}}); } / * If (Iplotro === true & amp; j) {var n = iptclass; B (E.RO) .eich (function (A) {a% 2 == 1? B (this). Andclass  

/ * New Details ** /> So even if we repeat the given jqGrid array 'Celero' and delete the rows one by one using jqGrid's default 'delRowData' function: <($ ("# JqGrid ('getGridParam', 'selarrrow'), function (index, value) {console.log (former) ($ ("# myBrid"). JqGrid ('delRowData', value)) {console.log ($ ("# MyGrid") ($ ("# myGrid"). JqGrid ('getGridParam', 'selarrrow'); if ($ ("# myGrid") .jqGrid ('getGridParam', 'selarrrow' ); Console.log (value);} and {console.log ($ ("# myGrid") JqGrid ( 'getGridParam', 'selarrrow')); console log (value);}});});

You will see that the code does not show properly and we have to go back to see the 'Gergrid core-code' function of 'Delroodata'. The problem is how it resolves the array. The function here is unmounted:

 delRowData: function (f) {var j = false, i, c; This.each (function () {var e = this; if (i = e.rows.nameItem (f)) {b (i) .remove (); eprecords--; epreccount--; e.updatepager (true, False); J = true; if (apmeltisel) {c = b.in atre (f, apslalero); // c; = 1 sap; apclrrooslxccccci}} if (f == apdorro) epidlloro = null} then returned false ; If (APDTTIP == "local") {var k = AP_indix [F]; if (typeofok! = "Undefined") {APData.plice (K, 1); e.refreshIndex ()}} If (Iplotro = == true & amp; j) {var n = optionclass; b (e.ro.) .eich (function (a) {a % 2 = 1? B (it) .addClass (n): B (it) .removeClass (n)})}}); Return j}  

between the function is commented outside of the problem line. I really wanted to avoid hacking core-code, but it seems you have to do this until you have a better idea.

itemprop = "text">

  $ ("# deleteButton"). Why click (function () {var errors = []; jQuery ("# ​​myGrid" ".jqGrid 'getGridParam', 'selarrrow') each (function (index, value) {if (! JQuery (" # MyGrid "). JqGrid ('delRowData', value)) errors.push (value);}); if (errors.length) {Warning ('Already deleted or not in list of rows:' + Errors.join (','));}});    

Comments