Thanks, but that doesn’t seem to give me what I need. Maybe a little more explanation is in order.
In the window I have a grid that lists employee names (read from a database) and allows the user to select which one(s) to send an email to. The user can choose “To”, “CC” or blank (meaning not a recipient). The list of names is dependent upon some other settings (defined in the page containing this popup window) so I need to refresh the list of employees each time the window is displayed.
I define the grid as follows:
recipientGrid: isc.ListGrid.create({
autoFetchData: true,
alternateRecordStyles: true,
showAllRecords: true,
canEdit: true,
editByCell: true,
fields: [
{name: "select", type: "text", canEdit: true, width: 50, valueMap: ["","To","CC"]},
{name: "name", canEdit: false},
{name: "company", canEdit: false}
],
dataSource: isc.DataSource.create({
clientOnly: true,
dataFormat: "json",
dataURL: "recipientlist",
fields: [
{name: "username", type: "text", primaryKey: true},
{name: "name", type: "text"},
{name: "company", type: "text"}
],
handleError: function(response, request) {logger.fatal("Error reading recipient list.");return false;}
}),
selectionChanged: function(record, state) {
recipientGrid.endEditing();
}
})
This data is not written back to the server. I read through the grid after the user clicks a button to determine which people were selected as recipients and then dismiss the window.
I also have a function that I call before showing the window that refreshes the grid data. The refresh works fine in that the list of names is rebuilt correctly, but any changes the user previously made to the “select” column still appear. I need all cells in this column to revert back to their original blank value.
clear: function() {
recipientGrid.deselectAllRecords();
if (recipientGrid.data && recipientGrid.data.invalidateCache)
recipientGrid.data.invalidateCache();
}
I originally thought that, since the “select” field is defined in the grid but not the datasource then this would simply be blank when the datasource is refreshed. I guess this is not the case?
Thanks again for the help.