Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » GridCtrl: master - detail
|
Re: GridCtrl: master - detail [message #33650 is a reply to message #33641] |
Sat, 03 September 2011 21:58 |
|
forlano wrote on Sat, 03 September 2011 04:46 | Hello,
is there a similar functionality in GridCtrl?
If not, are there snippet code able to simulate it?
I guess they should be in HomeBudget but the code look complex and I can't find what it is real useful. So some better localization of this part of code would be great.
Thanks,
Luigi
|
GridCtrl has no direct support for master/details functionality. But it's very easy to implement it.
GridCtrl master, details;
master.AddIndex(ID);
master.AddColumn(LIBRARY_NAME, "Library name");
master.WhenRowChange = THISBACK(UpdateDetails);
details.AddColumn(BOOK_NAME, "Book name");
void UpdateDetails()
{
SQL * Select(ID, BOOK_NAME).From(BOOKS).Where(LIBRARY_ID == master(ID)); //master(ID) returns ID from currently selected row
while(SQL.Fetch)
details.Add(SQL[BOOK_NAME]);
}
In this example master contains list of libraries and details contains books from selected library. Of course you have to add clearing details grid if new library is added. Is this helpful for you or you needed to know something more complicated?
|
|
|
|
Goto Forum:
Current Time: Fri Sep 20 03:33:30 CEST 2024
Total time taken to generate the page: 0.02765 seconds
|