PDA

View Full Version : Advanced use of ShowRowExpanderIcon event in v10 AJAX Grid


ABC123

Richard Rabins
10-06-2009, 05:19 AM
Advanced use of ShowRowExpanderIcon event in v10 AJAX Grid

When you use the Row Expander feature in a Grid, by default, the expand icon is shown next to each row in the Grid, regardless of whether that row actually has any child records or not. In some cases, you might want to suppress the row expander icon from showing if there if there are no child records. You can do this using the ShowRowExpanderIcon event.



Watch Video http://www.ajaxvideotutorials.com/V10Videos/ShowRowExpanderIconEvent.swf

chadbrown
10-22-2009, 12:40 AM
Nice video and an awesome feature!

I have a question in regards to this. I asked Selwyn and If I remember correctly he had asked me to rephrase this so here we go for all to see.

I have a grid which has a search fields and I want to add this row expander feature to the grid. However say I have 50000 records in the table and I am doing a search to return say 20 records does this feature do a count on the 20 records or the 50000 which would obviously be a waste of time, due to the fact that I only need it to do a count on the records in the search and show row expander icons only on the ones with counts greater than zero.

Please let me know if this is possible or not.

Thanks Chad

Peter.Greulich
10-22-2009, 01:28 AM
I have a grid which has a search fields and I want to add this row expander feature to the grid. However say I have 50000 records in the table and I am doing a search to return say 20 records does this feature do a count on the 20 records or the 50000 which would obviously be a waste of time, due to the fact that I only need it to do a count on the records in the search and show row expander icons only on the ones with counts greater than zero.

If you mean that your primary grid is based upon a table of 50,000 records, you're probably only going to display the first, say 20, 30, or 50 records. If you have the grid set for 30 records, the show expand icon feature only evaluates those 30 records, not the 50,000. If you then do a search on that primary grid and return 20 records (out of the 50,000), again, the show expand icon feature only evaluates those 20 records, not the 50,000. Even if your search returns a 1000 records, you're only going to display 30 at a time, and only the 30 displayed will be evaluated. As you call each subsequent page (30 records per page) of the 1000 returned, you only evaluate 30 at a time.

Make sense?

peteconway
10-22-2009, 03:58 AM
During the Beta process I requested this function as one of the problems was - users would click the row expander button and expect a result but got a message "no records in query". You have several options - keeping in mind you are only interested in if there are 1 or more records, you can exit the test by saying if = 1 then showrowexpander .t.

But it appears the rowexpander is jumping into the index anyhow, as it delivers an instant result whenever you click the rowexpander.

Give it a go - see what works, you may not need do anything than the standard test.

chadbrown
10-22-2009, 08:37 AM
Thanks guys for the responses I will work on it today. This is exactly what I was hoping for.

Chad

chadbrown
10-22-2009, 08:52 PM
It works very well and yeah it does only check the searched items. I am running it on mysql backend and is searching a table with about 20k records and returns the results on 50 records in about 4 seconds 500 records was a little slow but very reasonable. I am hoping to put together a video with some grids with rowexpanders. Most of my tables are about 100mb in size and have anywhere from 20k records to about 200k. Most of these expanders searches are very quick. Hopefully I will have something soon for everyone to see.

Chad