Author Topic: 2.2.0 refresh row  (Read 2938 times)

omerix

  • Pro Enterprise
  • Full Member
  • *
  • Posts: 148
    • View Profile
2.2.0 refresh row
« on: September 17, 2014, 03:45:03 am »
Hello,

I'm update 2.2.0 script

  rowData[recIndx] = data.recIndx;
, rowData['MODULID_AD'] = data.MODULID_AD;

is not work.

Thanks.


Full Update Code 2.1.0 (rowData[recIndx] = data.recIndx;), Run
Code: [Select]
/* ------------------------------------------------------------------------------------ Satır Update */
         function update(rowIndx, colIndx, UpdateType) {
             //debugger;
             if (!$grid.pqGrid("saveEditCell")) {
                 return false;
             }

             var rowData = $grid.pqGrid("getRowData", {
                 rowIndx: rowIndx
             });
             var isValid = $grid.pqGrid("isValid", {
                 rowData: rowData
             }).valid;
             if (!isValid) {
                 return false;
             }
             var isDirty = $grid.pqGrid("isDirty");
/* ------------------------------------------------------------------------------------ Değişiklik Varmı? */
             if (isDirty) {
                 var recIndx = $grid.pqGrid("option", "dataModel.recIndx");

                 var url = "<%=dosya%>?isl=GridKaydet";
                 if (rowData[recIndx] == null) {
                     url = "<%=dosya%>?isl=GridKaydet";
                 }
                 $.ajax($.extend({}, ajaxObj, {
                     url: url,
                     data: rowData,
                     success: function (data, textStatus, jqXHR) {
/* ------------------------------------------------------------------------------------ Hatasız Kayıt */
                        if (data.prkod == 0) {
                             $grid.pqGrid("removeClass", {
                                 rowIndx: rowIndx,
                                 cls: 'ui-state-error'
                             });
                             var recIndx = $grid.pqGrid("option", "dataModel.recIndx");
                             if (rowData[recIndx] == null) {rowData[recIndx] = data.recIndx;}
rowData['MODULID_AD'] = data.MODULID_AD;
console.log(data.MODULID_AD);
console.log(rowIndx);
                             //$grid.pqGrid("commit", {type: 'add',rows: rowIndx});
$grid.pqGrid("commit");
if (UpdateType=="40") {$grid.pqGrid("editCell", {rowIndx: (rowIndx + 1),colIndx: colIndx});};
if (UpdateType=="38") {$grid.pqGrid("editCell", {rowIndx: (rowIndx - 1),colIndx: colIndx});};
                        }
/* ------------------------------------------------------------------------------------ Hatasız Kayıt/ */
/* ------------------------------------------------------------------------------------ Hatalı Kayıt */
else {
                             //console.log(rowIndx);
                             $grid.pqGrid("addClass", {rowIndx: rowIndx,cls: 'ui-state-error'});
                             $grid.pqGrid("removeClass", {rowIndx: rowIndx,cls: 'pq-grid-row'});
                             $('<div></div>').html('Hata Kodu:' + data.prkod + '<br>' + data.prnot).dialog({
                                 position: ['center', 'top'],
                                 modal: true,
                                 zindex: 9002,
                                 title: 'Kayıt Hatası'
,close: function( event, ui ) {
$grid.pqGrid("editFirstCellInRow", {rowIndx: rowIndx});
}
                             });
                         }
/* ------------------------------------------------------------------------------------ Hatalı Kayıt/ */
                     },//success
/* ------------------------------------------------------------------------------------ Ajax Hata */
                     error: function (jqXHR, textStatus, errorThrown) {
                         $('<div></div>').html('Hata Kodu:' + jqXHR.status + '<br>' + jqXHR.statusText).dialog({
                             position: ['center', 'top'],
                             modal: true,
                             zindex: 9002,
                             title: textStatus
                         });
                     },//error
/* ------------------------------------------------------------------------------------ Ajax Hata/ */
//Ajax göndermeden önce
beforeSend: function (jqXHR, settings) {},
//Ajax isteği tamamlandığında
                     complete: function (jqXHR, textStatus) {}
                 }));
             }
/* ------------------------------------------------------------------------------------ Değişiklik Varmı?/ */

/* ------------------------------------------------------------------------------------ Değişiklik Yoksa */
else {
                 $grid.pqGrid("refreshRow", {rowIndx: rowIndx});
             }
/* ------------------------------------------------------------------------------------ Değişiklik Yoksa/ */
if (UpdateType=="40") {$grid.pqGrid("editCell", {rowIndx: (rowIndx + 1),colIndx: colIndx});};
if (UpdateType=="38") {$grid.pqGrid("editCell", {rowIndx: (rowIndx - 1),colIndx: colIndx});};
         };//update
/* ------------------------------------------------------------------------------------ Satır Update/ */

omerix

  • Pro Enterprise
  • Full Member
  • *
  • Posts: 148
    • View Profile
Re: 2.2.0 refresh row
« Reply #1 on: September 17, 2014, 06:32:07 pm »
Solved problem

Code: [Select]
                        if (data.prkod == 0) {
                             $grid.pqGrid("removeClass", {
                                 rowIndx: rowIndx,
                                 cls: 'ui-state-error'
                             });
                             var recIndx = $grid.pqGrid("option", "dataModel.recIndx");
                             if (rowData[recIndx] == null || rowData[recIndx]=='undefined') {
rowData[recIndx] = data.recIndx;
}
rowData['MODULID_AD'] = data.MODULID_AD;
//console.log(data.MODULID_AD);
//console.log(rowIndx);
$grid.pqGrid("commit");
//if (UpdateType=="40") {$grid.pqGrid("editCell", {rowIndx: (rowIndx + 1),colIndx: colIndx});};
//if (UpdateType=="38") {$grid.pqGrid("editCell", {rowIndx: (rowIndx - 1),colIndx: colIndx});};
                        }

Add Code
Code: [Select]
$grid.pqGrid("commit");
[color=red][b]$grid.pqGrid("refreshRow", {rowIndx:rowIndx});[/b][/color]