|
steven
|
 |
« on: February 12, 2009, 01:38:44 AM » |
|
If you have read Tutorial 6, things of this tutorial could become easier. What's difference between tree and tree grid? No difference. Let's do something to prove it.
[Req Spec] An tree grid with unlimited rows. When end user expand a row, grid shows its children rows; end user could expand one of the children rows, grid shows its grandson rows; and so on...
[Do It Yourself] 1. Drag an [treeGrid] to design area, set [alias] to "treegrid1"(Click [input] to select it, type "treegrid1" in [Component Config Window]->[alias],and strike [Enter] on keyboard). 3. Set [rows] of "treegrid1" to the following code. (Click "treegrid1" to select it,click on right side of [Component Config Window]->[properties]->[rows],a small button will appear. Click this button, a dialog box will pop up.) 4. You will see some default lines in the dialog. Generally, we could change it to the following code. I think you guys understand what this mean to grid -- this is a 2d array, please show them in two rows.
This time, I would like to change a little, just like the following code.
As you can see, I add a "sub" to the second row, which tells grid "oh, the second row is parent row, it has children". 5. Set [onGetContent] of "treegrid1" to the following code. (Click "treegrid1" to select it,click on right side of [Component Config Window]->[event]->[onGetContent],a small button will appear. Click this button, a dialog box will pop up.) 6. You could see something like this.
As same as tree, this function will be called when end user expand a parent row. Change the code to the following.
6. Click [OK] to close dialog. 7. Press [run] to see the result. If everything goes well, you will see a grid with unlimited rows. 8. If you want to do with real database, just change code in step 5 to
Be sure that treegrid.php take the following string back
|