Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

modify droppedRecord field onRecordDrop

$
0
0
Version v9.1p_2014-03-03/Enterprise Deployment (2013-03-03)

I'm trying to regroup a listgrid record when the user drags it into a new group (same listGrid), based on a "Custom Group" column.
As the user drops the record, its Custom Group value should change to match that of the record above it, followed by a redraw to take care of the rest.

I'm having trouble getting the correct index/rowNum to use setEditValue or refreshCell though - the 'index' parameter in onRecordDrop does not apply to the droppedRecord & using getRecordIndex just returns -1, record not found.

The following snippet is slightly modified (and broken) version of http://www.smartclient.com/docs/9.0/a/system/reference/SmartClient_Explorer.html#listGridFields.

Code:

isc.ListGrid.create({
  canReorderRecords: true,
    ID: "countryList",
    width:500, height:224, alternateRecordStyles:true,
    fields:[
        {name:"countryCode", title:"Code"},
        {name:"countryName", title:"Country"},
        {name:"independence", title:"Nationhood", type:"date"},
        {name:"population", title:"Population", type:"integer"},
        {name:"gdp", title:"GDP", type:"float"}
    ],
    data: countryData,
    onRecordDrop: function(droppedRecord, targetRecord, index) {
//insert logic to get appropriate value to update field here...

      this.setEditValue(index, "countryCode", "newValue");
      this.markForRedraw();
  }
})

Keeping this in mind, how would I go about changing a column value of droppedRecord, or am I going about this the wrong way?

Viewing all articles
Browse latest Browse all 4756

Trending Articles