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

ListGrid cellContextMenu editor update not add by default?

$
0
0
I've been monkeying with edit settings in a ListGrid. In the code sample I've pasted below, I can edit the cells just fine inline, but the context editor itself doesn't work. When I try to use it to edit the country name, an error pops up:

Code:

clientOnly add operation failed for DataSource isc_DataSource_0: Duplicate key in record {id: 1,
countryName: "United States123",
countryCode: "US",
capital: "Washington, DC",
_selection_1: true}

The context editor appears to be useless in my example, and perhaps other related uses. Would it make more sense for the editor to set saveOperationType:"update" by default for this context (i.e. without me needing recordEditorProperties)?

I'm using "v9.1p_2015-07-08/Pro Deployment"

Code:

countryData = [{
  id:1,
  countryName:"United States",
  countryCode:"US",
  capital:"Washington, DC",
},
{
  id:2,
  countryName:"China",
  countryCode:"CH",
  capital:"Beijing",
},
];

isc.ListGrid.create({
  autoDraw:true,
  ID: "countryList",
  width:500, height:224, alternateRecordStyles:true,
  dataSource: isc.DataSource.create({
      clientOnly:true,
      fields:[
        {name:"id",primaryKey:true},
        {name:"countryCode", title:"Code",canEdit:false},
        {name:"countryName", title:"Country", canEdit:true},
        {name:"capital", title:"Capital"}
      ],
      cacheData: countryData
  }),
  /*
  recordEditorProperties: {
      //if you don't do this, cell context edits will duplicate records
      saveOperationType:"update"
  },
  */
  editByCell: true,
  showCellContextMenus: true,
  autoFetchData:true,
});


Viewing all articles
Browse latest Browse all 4756

Trending Articles