Author Topic: getData function problem after upgrading to ver 2.1  (Read 2285 times)

lsl

  • Pro Deluxe
  • Jr. Member
  • *
  • Posts: 67
    • View Profile
getData function problem after upgrading to ver 2.1
« on: June 16, 2014, 01:09:00 pm »
we have a editor using getData
it works fine in the last version of PQgrid, after we upgrade to version 2.1, it failed to get the value of the editing cell now.

which is : ui.$cell[0].textContent
gives me ""

which gives me the exact cell value in the past version

Code: [Select]
             
editor:
            {
                type: "textbox",
                getData:function (ui)
                {   
  $("#TESTGRID1").pqGrid( "updateRow", { rowIndx: ui.rowIndx, row: {"profits":Number(ui.$cell[0].textContent)*40} });
$(".pq-editor-border").css("display","none");
return ui.$cell[0].textContent;
}
            }

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: getData function problem after upgrading to ver 2.1
« Reply #1 on: June 16, 2014, 04:57:25 pm »
you can't get input (textbox) value with textContent

ui.$cell is editor's container

so textbox value would be ui.$cell.find("input").val()

Anyway though not related to your question, I see that you have been using getData merely to update a dependent cell which might not be optimal solution.

cellSave is an appropriate event to update a dependent cell.

            cellSave: function (evt, ui) {
                debugger;
                if(ui.dataIndx == 'dataIndx of that column'){
                    $(this).pqGrid( "updateRow", { rowIndx: ui.rowIndx, row: { 'profits' : ui.value * 40 }});
                }
            },
« Last Edit: June 16, 2014, 08:09:30 pm by paramquery »