hidden rows
hidden rows
Hi,
I would just like to inform people that I have added (very rough) support for hidden rows.
I thought it would be good to let people know that if they wanted it just let me know and I will post it up.
If I have:
item 1
items 1a
items 1b
item 2
item 3
item 3a
item 3a
what I wanted was the the items 1a, 1b, and 3a to be hidden until the parent is clicked and it would then show them. For example it I click item 3 it would show the two 3a items. whereas if I clicked item 1 it would show 1a and I would then click 1a to show 1b.
anyway, I have simply added css to set the display for the row to none. then some normal basic js to put a toggle on each item that is need. The issue I had was one the row count. (It would count the hidden rows), the pagniation as if a hidden column went over to another page it would not be seen when expanded. The other problem was to do with the search. If I would search for 1b for instance it would not come back saying no match but equally would not show the item.
I modified the main script so then if the search != null then it will automaticly set all the display to block. If I then delete what was in search it would go back to hidding them again. I haven't yet found a solution to the pagination problem but was wondering if it would be easy to put in proper support for hidden rows like in the senario above. I would be happy to continue work on this and post my code if people want but is it something you are already working on?
I haven't yet looked at the ajax support for this yet. This works if the data it loaded already when the page intially runs.
Thanks
k0r54
I would just like to inform people that I have added (very rough) support for hidden rows.
I thought it would be good to let people know that if they wanted it just let me know and I will post it up.
If I have:
item 1
items 1a
items 1b
item 2
item 3
item 3a
item 3a
what I wanted was the the items 1a, 1b, and 3a to be hidden until the parent is clicked and it would then show them. For example it I click item 3 it would show the two 3a items. whereas if I clicked item 1 it would show 1a and I would then click 1a to show 1b.
anyway, I have simply added css to set the display for the row to none. then some normal basic js to put a toggle on each item that is need. The issue I had was one the row count. (It would count the hidden rows), the pagniation as if a hidden column went over to another page it would not be seen when expanded. The other problem was to do with the search. If I would search for 1b for instance it would not come back saying no match but equally would not show the item.
I modified the main script so then if the search != null then it will automaticly set all the display to block. If I then delete what was in search it would go back to hidding them again. I haven't yet found a solution to the pagination problem but was wondering if it would be easy to put in proper support for hidden rows like in the senario above. I would be happy to continue work on this and post my code if people want but is it something you are already working on?
I haven't yet looked at the ajax support for this yet. This works if the data it loaded already when the page intially runs.
Thanks
k0r54
This discussion has been closed.
Replies
Nice one! Thanks very much for posting about this. It would indeed be interesting to see your code - and an example if you have one :-)
I presume the paging problem you mention is what happens if you 'open' a row you get more records that should be on the page? One method I was considering in future for dealing with this is to have a flag which indicates if the row should be included in the display or not. This could then be toggled based on an action, and thus all aspects of DataTables will work well. The one difficulty it keeping the rows together is the sorting changed! aaFixedSorting can help with that to some extent, but this is really one for DataTables 2.0 I think... :-). Until then this is brilliant! Thanks.
Regards,
Allan