PDA

View Full Version : How to toggle the checkbox in TreePanel programily



cenyongh
7 Sep 2011, 8:20 AM
I find solution for ext 1.1 , but havn't find out a solution for ext4. I have try the following solutions but still without luck.
1. use the ui or getUI() method of a model. But it seems ext4 dosen't provide this method.
2. use selection model's select() method.

thx in advance

jay@moduscreate.com
7 Sep 2011, 8:31 AM
you might be able to do model.set('checked', true || false);

cenyongh
7 Sep 2011, 5:39 PM
thx, it works. Btw, are there any clues there i can find in the api docs.

skirtle
8 Sep 2011, 6:21 AM
I don't believe it's explicitly documented but the docs include links to the code. Don't be afraid of the code.

The way to find out this kind of thing for yourself would be...


Observe that the treepanel has a getChecked() method. Click the 'View Source' link on the right-hand side of the docs.
All it does is call getChecked() on the view, so open up the docs for the treeview.
Doesn't seem getChecked() is documented. No matter. Just click on the big green class name at the top of the docs to open the source. Search for getChecked().
Observe that getChecked() works by reading the checked field out of the record.
Try record.set('checked', true); It works. Job done.


You'll find you need to do this kind of 2 minute investigation all the time. You learn all sorts of interesting things this way.

cenyongh
8 Sep 2011, 7:44 PM
fantastic´╝îskirtle´╝îit really help me a lot.