Hi,
I would like my listgrid to behave like this:
1. Always have an empty row as the first row in the listgrid.
2. When user edit the value for the empty row, system should save the edited value as new row and auto insert new empty row as the first row in the listgrid when user finished editing.
3. If user edit other rows that's not empty, upon finished editing, system show the empty row in edit mode again.
Below is my code
The problem now is, after editing the empty row, if user press tab, the empty row can be shown in edit mode, and the cursor appear at second column, however, if user press enter key, empty row got created but not shown in edit mode. How can I make the empty row to show in edit mode when user either press on tab or enter key and to have the focus in the first column, thank you.
I would like my listgrid to behave like this:
1. Always have an empty row as the first row in the listgrid.
2. When user edit the value for the empty row, system should save the edited value as new row and auto insert new empty row as the first row in the listgrid when user finished editing.
3. If user edit other rows that's not empty, upon finished editing, system show the empty row in edit mode again.
Below is my code
Code:
staffdata = [
{name:"user a", hp:"4645646"},
{name:"user b", hp:"1212121"},
{name:"user c", hp:"4645646"},
{name:"user d", hp:"1212121"},
{name:"user e", hp:"1212121"}
]
isc.ListGrid.create({
ID:"myGrid",
autoDraw:true,
margin: 10,
autoFitData: "both",
data:staffdata,
editOnFocus: true,
fields:[
{name:"name", title:"Name", canEdit: true},
{name:"hp", title:"Handphone", canEdit: true}
],
editorExit: function (editCompletionEvent, record, newValues, rowNum) {
if(isc.isA.String(newValues) && rowNum == 0){
myGrid.data.add({name:null, hp:null},0);
myGrid.startEditing(0,0);
}
return true;
},
bodyOverflow:"auto"
});
myGrid.data.add({name:null, hp:null},0);
myGrid.startEditing();
Comment