I have a TreeGrid based on a client only datasource (code below). The user can edit the records. When the user has completed the edits, they submit multiple lists in a batch (The update on the server updates the intersections of the multiple lists).
When the user clicks the submit button, I manually retrieve the Tree Nodes and post them to the server. At this point, all edits made against the TreeGrid are gone. For instance, there’s a bool field called ViewPermission. In the tree, was initialized as false, edited to be true. When I iterate the TreeNodes, it’s false. Is there a way to retrieve the the same information that’s being displayed in the TreeGrid? (I use the same technique on ListGrid’s without this issue).
Thanks in advance,
Paul
isc.DataSource.create({
ID: "ShowToUGDefaultPermissionsSTUB",
fields: [
{ name: "ObjectName", title: "Show/Folder", type: "string", canEdit: false,
getFieldValue: function(record, value, field, fieldName) {
var orStr = (XMLTools.selectString(record, ".//Overrides") == true) ? " <b>OR</b>" : "";
return XMLTools.selectString(record, ".//ObjectName") + orStr;
}
},
{ name: "DivID", title: "DivID", type: "integer", canEdit: false },
{ name: "ShowCategoryID", title: "ShowCategoryID", type: "integer", canEdit: false },
{ name: "ShowCategoryTitle", title: "ShowCategoryTitle", type: "string", canEdit: false },
{ name: "ShowID", title: "ShowID", type: "integer", canEdit: false },
{ name: "ParentID", title: "ParentID", type: "integer", foreignKey: "ShowID", rootValue: "0" },
{ name: "ShowName", title: "ShowName", type: "string", canEdit: false },
{ name: "ShowFolderID", title: "ShowFolderID", type: "integer", canEdit: false },
{ name: "ShowFolderName", title: "ShowFolderName", type: "string", canEdit: false },
{ name: "Sort", title: "Sort", type: "integer", canEdit: false },
{ name: "StartDate", title: "StartDate", type: "date",
getFieldValue: function(record, value) {
return getDateValue("min", value);
}
},
{ name: "EndDate", title: "EndDate", type: "date",
getFieldValue: function(record, value) {
return getDateValue("max", value);
}
},
{ name: "ViewPermission", title: "ViewPermission", type: "boolean", width: 60},
{ name: "DownloadPermission", title: "DownloadPermission", type: "boolean", width: 65},
{ name: "EditPermission", title: "EditPermission", type: "boolean", width: 60},
{ name: "UploadPermission", title: "UploadPermission", type: "boolean", width: 60},
{ name: "DeletePermission", title: "DeletePermission", type: "boolean", width: 60},
{ name: "ShowManagerPermission", title: "ShowManagerPermission", type: "boolean", width: 85}
],
testData: [],
clientOnly: true
});
isc.TreeGrid.create({
ID: "ShowsToUGsAddShowsList",
width: "100%",
showOpenIcons: false,
showDropIcons: true,
closedIconSuffix: "",
canAcceptDroppedRecords: true,
canDragRecordsOut: false,
dataSource: "ShowToUGDefaultPermissionsSTUB",
autoFetchData: false,
showFilterEditor: false,
canEdit: true,
autoSaveEdits: true,
showAllRecords: false,
showEmptyMessage: true,
alternateRecordStyles: true,
animateFolders: false,
selectionType: "multiple",
cellContextClick: "return ShowsToUGsAddShowsListMenu.showContextMenu()",
getIcon: function(node) {
return null;
},
data: isc.Tree.create({
modelType: "parent",
rootValue: "0",
nameProperty: "ObjectName",
idField: "ShowID",
parentIdField: "ParentID",
data: []
}),
cellClick: function(record, rowNum, colNum) {
if (colNum > 0) {
ShowsToUGsAddShowsList.startEditing(rowNum);
}
},
canEditCell: function(rowNum, colNum) {
var record = this.getRecord(rowNum),
fieldName = this.getFieldName(colNum);
if ((fieldName == "StartDate" || fieldName == "EndDate" || fieldName == "ShowManagerPermission")
&& record.ShowID == (-1)) {
return false;
}
return this.Super("canEditCell", arguments);
},
fields: [
{ name: "ObjectName", title: "Show/Folder", type: "string", canEdit: false, width: 125 },
{ name: "ViewPermission", title: "View", type: "boolean", width: 50 },
{ name: "DownloadPermission", title: "Download", type: "boolean", width: 50 },
{ name: "EditPermission", title: "Edit", type: "boolean", width: 50 },
{ name: "UploadPermission", title: "Upload", type: "boolean", width: 50 },
{ name: "DeletePermission", title: "Delete", type: "boolean", width: 50 },
{ name: "ShowManagerPermission", title: "ShowManager", type: "boolean", width: 75 },
{ name: "StartDate", title: "StartDate", type: "date" },
{ name: "EndDate", title: "EndDate", type: "date" }
]
});
function SaveAssignedShowsToUsergroups() {
var ugs = "";
var frst = true;
var shs = [];
if (ShowsToUGsAddShowsList.data.length == 0) {
alert('There are no Shows to assign to Usergroups.');
return false;
}
frst = true;
for (y = 0; y < ShowsToUGsUGListTO.data.length; y++) {
var ug = ShowsToUGsUGListTO.data[y].UserGroupId;
if (frst == true) { frst = false; } else { ugs += "~"; }
ugs += ug;
}
var folds = ShowsToUGsAddShowsList.data.getChildren(ShowsToUGsAddShowsList.data.getRoot());
for (f = 0; f < folds.length; f++) {
shs.push(folds[f]);
// alert(folds[f].ObjectName + '\n' + folds[f].EditPermission);
}
var req = { actionURL: "/admin/service/PermissionPost.ashx",
httpMethod: 'POST',
params: {
method: "update_ShowsToUsergroups",
shows: shs,
usergroups: ugs
},
callback: 'SaveAssignedUsersToUsergroupsComplete()'
}
isc.RPCManager.sendRequest(req);
}