Hi,
I would like to add a line to a tree grid similarly to the creation of a folder in Windows Explorer : it creates a child of the current folder, naming it New folder 1, New folder 2, etc, ensuring uniqueness of the folder name.
Assuming the tree grid has a record with UniqueName being the name of a field with unique value (distinct from the primary key, which is classically an auto-incremented sequential number), I would therefore like to :
– select a line (the parent of the child I want to create)
– click a button (or right click a menu option, or whatever…)
– add a new line, and set-up its parent field to the current line, so it becomes a child
– preset the UniqueName with a dummy value like Line 1 (or Line 2 or Line 3…) so uniqueness is ensured, then put in edit mode so the value can be changed
Although I’m getting started with jqWidgets, I believe I’m now able to perform all steps, except one : check if Line 1 exists or not (so that I name it Line 2, unless it exists in which case I name it Line 3, etc.).
I asked in a previous post if there’s a way to read all children of a given row. Looping into the list would then give the answer.
But the purpose of this post is to check if there is not by chance an even more direct way : is there a method in treeGrid that returns true or false depending on a set of conditions ? In this case, something like :
var alreadyPresent = $("#treeGrid").jqxTreeGrid('someKindOfTestMethod', 'UniqueName == "Line 1" && ParentID == ' + curRowID);
Just in case… 🙂
Thank you