Editing a dojox DataGrid connected to a JsonRest store

A little bit of a problem with using a dojox.grid.DataGrid connected to a dojo.store.JsonRest data store.

Note that dojox.grid is officially abandoned so it’s not really a very good idea to use it anyway – should be using dgrid or GridX instead.

If you edit a cell value then timing issues mean that although the change is held (and will be saved when you store.save()) the displayed value reverts to the original.

One way around this is to make use of onApplyCellEdit.

You can also use this function to call this.store.save() if you want to save after every change.

There also appears to be a problem with adding rows not displaying as well.

 function saveCellEdit(inValue, inRowIndex, inAttrName){
	/*
	 this.store.save();
	 */
	var data = this.getItem(inRowIndex);
	data[inAttrName] = inValue;
  };
  /*create a new grid*/
  var grid = new DataGrid({
			id : 'grid',
			store : store,
			structure : layout,
			rowSelector : '20px',
			onApplyCellEdit: saveCellEdit
		});

Some relevant links:

Leave a Reply

Your email address will not be published. Required fields are marked *