I have a database with several tables. Each table has a different name for its ID column (part_id, module_id, supplier_id, etc.). I’m loading data from these tables into trees using the following XML format:
Is there a simple way to specify which of these values the tree uses as its ID and which as its value? I’m thinking of something like mapping in DataTables. I know I could use custom DataDrivers, but I’d have to create a driver for each tree as the column names are different in every table.
The thing is that IDs in the dataset cannot be changed in such an easy way. To change item id, you should call the changeId(old_id, new_id) method of the component, which is possible after the data has been loaded:
Behavior when id can’t be changed in the $init handler is actually a bug, and will be fixed in next updates. For now you can use solutions proposed by Helga