I have the strangest bug that happens on certain occasions. The problem is that when I set selection on the listgrid, it loses the selection. I tried debugging it and it looks like the grid is not keeping the selection. This only consistently happens when I have grouping in my table and it only happens after I refresh the page. I have so far been unable to reproduce with a standalone testcase. I've also overriden selectRecord and deselectRecord for debugging to make sure it is not being called elsewhere besides the code below.
I've attached a screenshot of the debug in IE. The attached screenshot is on breakpoint after object.selectRecord() call
The following code is where I select the record - this has to be done because of server call when selection is changed. We keep the initial primary key and send to the server, server does updates and returns with either the same primary or a different one (in this simple test case, nothing about the table is changed therefore I expect the same selection to be visible). Before I call selectRecord, I make sure to clear all selection first in case the selection coming from the server is different.
Another thing to note is when data is initially loaded, I get the following error in the JS Console:
findByKeys: passed record does not have a value for key field 'cwPK__'
When I debugged this message, I found that it was being shown for the same listgrid I am having problems with. But as you can see in the data, all the row data have cwPK values.
data from RPC log:
I've attached a screenshot of the debug in IE. The attached screenshot is on breakpoint after object.selectRecord() call
The following code is where I select the record - this has to be done because of server call when selection is changed. We keep the initial primary key and send to the server, server does updates and returns with either the same primary or a different one (in this simple test case, nothing about the table is changed therefore I expect the same selection to be visible). Before I call selectRecord, I make sure to clear all selection first in case the selection coming from the server is different.
Code:
deselecting record: if(object!=null && object.data!=null){ object.deselectAllRecords(); } selecting record: if(object!=null && object.data!=null){ var currentData = null; if(object.originalData!=null && object.originalData.findByKey!=null){ currentData = object.originalData; }else{ currentData = object.data; } var record = currentData.findByKey(pk); if(record!=null){ object.selectRecord(record); } }
findByKeys: passed record does not have a value for key field 'cwPK__'
When I debugged this message, I found that it was being shown for the same listgrid I am having problems with. But as you can see in the data, all the row data have cwPK values.
data from RPC log:
Code:
[ { endRow:10, queueStatus:0, totalRows:10, isDSResponse:true, invalidateCache:false, status:0, startRow:0, data:[ { cwPK__:"14110008", $isCwSelected:false, orderNumber:"8914216", orderVersion:0, custName:"", orderType:"NEW", suppType:"", getDate:"07-14-2011", curEditor:"User Profile Administrator", milestone:"InProgress", milestoneStatus:"", displayStatus:"InProgress", solution:"Business Line", services:"Business Line", iADCaseNum:"" }, { cwPK__:"14110007", $isCwSelected:false, orderNumber:"8914181", orderVersion:0, custName:"", orderType:"NEW", suppType:"", getDate:"07-14-2011", curEditor:"User Profile Administrator", milestone:"InProgress", milestoneStatus:"", displayStatus:"InProgress", solution:"Calling Card", services:"Calling Card", iADCaseNum:"" }, { cwPK__:"14110006", $isCwSelected:false, orderNumber:"8914146", orderVersion:0, custName:"", orderType:"ADD", suppType:"", getDate:"07-14-2011", curEditor:"User Profile Administrator", milestone:"InProgress", milestoneStatus:"", displayStatus:"InProgress", solution:"Calling Card", services:"Calling Card", iADCaseNum:"" }, { cwPK__:"14110005", $isCwSelected:false, orderNumber:"8914124", orderVersion:0, custName:"", orderType:"NEW", suppType:"", getDate:"07-14-2011", curEditor:"User Profile Administrator", milestone:"InProgress", milestoneStatus:"", displayStatus:"InProgress", solution:"", services:"", iADCaseNum:"" }, { cwPK__:"14110004", $isCwSelected:true, orderNumber:"8914102", orderVersion:0, custName:"", orderType:"CHG", suppType:"", getDate:"07-14-2011", curEditor:"User Profile Administrator", milestone:"InProgress", milestoneStatus:"", displayStatus:"InProgress", solution:"", services:"", iADCaseNum:"" }, { cwPK__:"14110003", $isCwSelected:false, orderNumber:"8914068", orderVersion:0, custName:"", orderType:"CHG", suppType:"", getDate:"07-14-2011", curEditor:"User Profile Administrator", milestone:"InProgress", milestoneStatus:"", displayStatus:"InProgress", solution:"Business Line", services:"Business Line", iADCaseNum:"" }, { cwPK__:"14110002", $isCwSelected:false, orderNumber:"8914034", orderVersion:0, custName:"", orderType:"CHG", suppType:"", getDate:"07-14-2011", curEditor:"User Profile Administrator", milestone:"InProgress", milestoneStatus:"", displayStatus:"InProgress", solution:"Business Line", services:"Business Line", iADCaseNum:"" }, { cwPK__:"14110001", $isCwSelected:false, orderNumber:"8914000", orderVersion:0, custName:"", orderType:"CHG", suppType:"", getDate:"07-14-2011", curEditor:"User Profile Administrator", milestone:"InProgress", milestoneStatus:"", displayStatus:"InProgress", solution:"Business Line", services:"Business Line", iADCaseNum:"" }, { cwPK__:"14100005", $isCwSelected:false, orderNumber:"8913170", orderVersion:0, custName:"", orderType:"NEW", suppType:"", getDate:"07-14-2011", curEditor:"User Profile Administrator", milestone:"InProgress", milestoneStatus:"", displayStatus:"InProgress", solution:"", services:"", iADCaseNum:"" }, { cwPK__:"14100004", $isCwSelected:false, orderNumber:"8913170", orderVersion:0, custName:"", orderType:"NEW", suppType:"", getDate:"07-14-2011", curEditor:"User Profile Administrator", milestone:"InProgress", milestoneStatus:"", displayStatus:"InProgress", solution:"Business Line", services:"Business Line", iADCaseNum:"" } ] } ]
Comment