I am attempting to implement a TreeGrid that for files on a file system. I've implemented a simple server DataSource that implements the data source operations for files. As for the data source fields, the file's pathname is the primaryKey, and a "parent" field specifies "pathname" as the foreignKey. Common file operations (move, rename) are implemented in the "update" data source operation.
The problem is that the pathname is not an immutable primaryKey. If you move (reparent) the file, or rename the file, the pathname changes, so the cached value in the ResultSet is no longer valid. Indeed according to the FAQ: "The primary key value returned on an update must exactly match the value in the cached record. "
I can of course call invalidateCache() on the datasource, but this redraws the entire tree.
My question is: In the absence of an immutable primaryKey, as you would normally have for a database record, is there any way to properly implement move (reparent) and rename operations? I was thinking perhaps some related updates attached to the DSResponse. I thought I would ask first if there is a known/supported way of doing this before attempting that.
I have also thought of trying to use the UNIX I-nodes and NTFS file identifiers, but this gets into native code that I'd rather avoid.
Any tips would be greatly appreciated!
1. SmartClient Version: v8.3p_2012-12-31/Pro Deployment (built 2012-12-31)
2. Firefox 17.0.9
The problem is that the pathname is not an immutable primaryKey. If you move (reparent) the file, or rename the file, the pathname changes, so the cached value in the ResultSet is no longer valid. Indeed according to the FAQ: "The primary key value returned on an update must exactly match the value in the cached record. "
I can of course call invalidateCache() on the datasource, but this redraws the entire tree.
My question is: In the absence of an immutable primaryKey, as you would normally have for a database record, is there any way to properly implement move (reparent) and rename operations? I was thinking perhaps some related updates attached to the DSResponse. I thought I would ask first if there is a known/supported way of doing this before attempting that.
I have also thought of trying to use the UNIX I-nodes and NTFS file identifiers, but this gets into native code that I'd rather avoid.
Any tips would be greatly appreciated!
1. SmartClient Version: v8.3p_2012-12-31/Pro Deployment (built 2012-12-31)
2. Firefox 17.0.9
Comment