Author Topic: Can't use "ui.rowData" in editable for version 2.4.1  (Read 6621 times)

noctrona

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 82
    • View Profile
Can't use "ui.rowData" in editable for version 2.4.1
« on: July 07, 2015, 07:49:33 pm »
Hi team,

I have a problem want to confirm.
Please have a look with my codes:

Code: [Select]
{ title: "Product",  dataIndx: "product",width: 130,
editor: {
type: "select", options: productArray,style: 'width:230px;'
},
render: function (ui) {                             
//return (ui.cellData.split(':')[0]);
if(ui.cellData == '' || ui.cellData == null){
return '';
}
else{
return (ui.cellData == '' ? '' : ui.cellData.split(':')[0]);
}   
},
editable: function(ui){
var rowIndx=ui.rowIndx;
[b]var status = ui.rowData['status'];[/b]
if(status == 'SPR Counter Offer'){
return false;
}
else{       
return true;   
}
}
}

I have another column which index is "status". In previous version(2.1.0) I can get the status value by "ui.rowData['status']". But now when I test it with new version(2.4.1) the "ui.rowData" is undefined. But I can use this in render function.

Is there have any problem with my codes?


Thank you!

noctrona

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 82
    • View Profile
Re: Can't use "ui.rowData" in editable for version 2.4.1
« Reply #1 on: July 08, 2015, 09:32:48 am »
Hi team,

I have a problem want to confirm.
Please have a look with my codes:

Code: [Select]
{ title: "Product",  dataIndx: "product",width: 130,
editor: {
type: "select", options: productArray,style: 'width:230px;'
},
render: function (ui) {                             
//return (ui.cellData.split(':')[0]);
if(ui.cellData == '' || ui.cellData == null){
return '';
}
else{
return (ui.cellData == '' ? '' : ui.cellData.split(':')[0]);
}   
},
editable: function(ui){
var rowIndx=ui.rowIndx;
[b]var status = ui.rowData['status'];[/b]
if(status == 'SPR Counter Offer'){
return false;
}
else{       
return true;   
}
}
}

I have another column which index is "status". In previous version(2.1.0) I can get the status value by "ui.rowData['status']". But now when I test it with new version(2.4.1) the "ui.rowData" is undefined. But I can use this in render function.

Is there have any problem with my codes?


Thank you!

Please have a look with the attached screenshot.
And the following info:
Code: [Select]
<link rel="stylesheet" href="{!URLFOR($Resource.jqueryPPP, 'jquery-ui.css')}" />
   
    <script src="{!URLFOR($Resource.jqueryPPP, 'jquery.min.js')}"></script>
    <script src="{!URLFOR($Resource.jqueryPPP, 'jquery-ui.min.js')}"></script>
   
    <script src="/support/console/32.0/integration.js" type="text/javascript"></script>

    <!--ParamQuery Grid files-->
    <link rel="stylesheet" href="{!URLFOR($Resource.paramQuery241, 'pqgrid.min.css')}" />
    <!--<link rel="stylesheet" href="{!URLFOR($Resource.paramQuery241, 'pqSelect/pqselect.min.css')}" />-->
    <script src="{!URLFOR($Resource.paramQuery241, 'pqgrid.min.js')}"></script>
    <!--<script src="{!URLFOR($Resource.paramQuery241, 'pqSelect/pqselect.min.js')}"></script>-->

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Can't use "ui.rowData" in editable for version 2.4.1
« Reply #2 on: July 08, 2015, 10:32:29 am »
Noctrona

ui.rowData is present in column.editable for 2.4.1

It's used in this demo http://paramquery.com/pro/demos/readonly_cells and it's the same code for 2.4.1

Are you facing this issue for all columns.

noctrona

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 82
    • View Profile
Re: Can't use "ui.rowData" in editable for version 2.4.1
« Reply #3 on: July 08, 2015, 10:49:09 am »
Noctrona

ui.rowData is present in column.editable for 2.4.1

It's used in this demo http://paramquery.com/pro/demos/readonly_cells and it's the same code for 2.4.1

Are you facing this issue for all columns.

Yes.
The problem only happened when I create a new row in table. If I double click a cell for an existing records, the "editable" can works well.
But if I create a new empty row. The problem happened. Is that caused by the empty row contents?
Please have a look with my codes about add a new empty row in table:
Code: [Select]
$("#addColumn").click(function(){
var DM = $( "#grid_json" ).pqGrid( "option", "dataModel" );
if(typeof(DM.data) != "undefined"){
var rows = DM.data.length;
var rowData = { Id:'',productId:'',product:'',
basicMaterial:'', MissingDataMessage : '',status:'',
volume:0,startDate: sDate,endDate:eDate,accessoryId:'',
volumeEdit:false,cosEdit:false
};
$( "#grid_json" ).pqGrid("addRow", { rowIndxPage: rows+1, rowData: rowData });
if(isPriceAnalyst != 'true'){
$("#grid_json").pqGrid("addClass", { rowIndx: rows, dataIndx: 'costOfSalesUnit', cls: 'unEdit-pq-col' });
}                 
}

if(sforce.console.isInConsole()) {
sforce.console.setTabUnsavedChanges(true, undefined);
editSign = true;
}
});

I think these parts caused the problem. But it works well with old version (2.1.0)
« Last Edit: July 08, 2015, 11:18:47 am by noctrona »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Can't use "ui.rowData" in editable for version 2.4.1
« Reply #4 on: July 08, 2015, 11:40:59 am »
I've submitted it for further examination.

Meanwhile you can use getRowData() method to get rowData from rowIndx.

http://paramquery.com/pro/api#method-getRowData

noctrona

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 82
    • View Profile
Re: Can't use "ui.rowData" in editable for version 2.4.1
« Reply #5 on: July 08, 2015, 01:22:22 pm »
I've submitted it for further examination.

Meanwhile you can use getRowData() method to get rowData from rowIndx.

http://paramquery.com/pro/api#method-getRowData

Thanks for your support.
As I test it caused by my add new row in pgtable.
And it is very strange, when I create a new row, I will set some initial value for each column, some of them have default value, some of them are "".
Then when this finished, after the "addRow" function, this row insert my pqtable. Then some column have "render" function. I debug one of them. When I check the ui.rowData for one render function, I can't get all column which I initialed in my addRow function. Only some of them.

Thank you!

I'm not sure whether my description is clearly...

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Can't use "ui.rowData" in editable for version 2.4.1
« Reply #6 on: July 08, 2015, 01:33:39 pm »
It seems some of your columns are uneditable but you want to persist all field values passed in addRow.

You could pass checkEditable: false to addRow method.

http://paramquery.com/pro/api#method-addRow

noctrona

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 82
    • View Profile
Re: Can't use "ui.rowData" in editable for version 2.4.1
« Reply #7 on: July 08, 2015, 03:06:02 pm »
It seems some of your columns are uneditable but you want to persist all field values passed in addRow.

You could pass checkEditable: false to addRow method.

http://paramquery.com/pro/api#method-addRow

Thanks for your support! :)