Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » GridCtrl: master - detail
Re: GridCtrl: master - detail [message #33651 is a reply to message #33650] Sat, 03 September 2011 23:23 Go to previous message
forlano is currently offline  forlano
Messages: 1185
Registered: March 2006
Location: Italy
Senior Contributor
unodgs wrote on Sat, 03 September 2011 21:58


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?



Thanks a lot Daniel,

I needed just this example to feel confident that the work can be done.

Luigi
 
Read Message
Read Message
Read Message
Previous Topic: GridCtrl/DropGrid problem: Value related.
Next Topic: [SOLVED] ArrayCtrl and German characters
Goto Forum:
  


Current Time: Fri Apr 26 15:29:08 CEST 2024

Total time taken to generate the page: 0.03003 seconds