Best way to build a table...
Best way to build a table...
Belisarius
Posts: 26Questions: 0Answers: 0
I've been using Datatables for a small app at my work and for most instances it works fine out of the box. However in some cases I may get a user pulling back 15-20,000 records which come back OK, and firefox can handle OK (memory for firefox goes up to about 300K) but IE (used on our Intranet) struggles and memory approaches a gig! No good when this will be accessed via Citrix...
I've had a basic table using server side scripts working fine but this table is built differently for each user type. Depending on whether you are one of three user types determines which columns you see and often in what format, and also the data in some fields determines what appears in other fields in that row.
I'm not after a complete solution here but just want some broad guidelines on how to approach this? I could simplify it a little by maybe having three pages, one for each user type? And assume then I need to call my functions to format the columns/fields/rows prior to each draw event? Or should I do some of the user type filtering of data on the server side before I pass it to Datatables?
It's a while since I've used Datatables in 'depth' so I'm a little rusty but any pointers would be appreciated :)
Cheers
Andy
I've had a basic table using server side scripts working fine but this table is built differently for each user type. Depending on whether you are one of three user types determines which columns you see and often in what format, and also the data in some fields determines what appears in other fields in that row.
I'm not after a complete solution here but just want some broad guidelines on how to approach this? I could simplify it a little by maybe having three pages, one for each user type? And assume then I need to call my functions to format the columns/fields/rows prior to each draw event? Or should I do some of the user type filtering of data on the server side before I pass it to Datatables?
It's a while since I've used Datatables in 'depth' so I'm a little rusty but any pointers would be appreciated :)
Cheers
Andy
This discussion has been closed.
Replies
About the firefox vs ie - it is known that manipulating many rows is ok in some browsers (firefox, chrome) and very bad in ie.
The word says that ie 9 fixed that - but I haven't tested myself so I can't help you there - sorry.
To fix that you can handle dataTables on server side so the client will get only a few tens of row - that will "fix" your problem - but will resolve in many db calls.
About the 3 diffrent views - it depends.
If the 3 different views are importent for security reasons - do the formating at serverside - and serverside only!
If the 3 different views are there for semantic reasons only (view number one is first and last name together, second view seperates first and last name, etc.) - you can handle that from inside datatables.
If you need 3 different views for semantic reasons only I will suggest you to do the following:
Add all of the wanted cols of all of the views (which probably have much in common as they are the same table) - and hide unwanted cols by the needed view.
Just add 3 booleans in the top of you php file (isView1, isView2, isView3) , then, go to the headers of the table and add the following:
style="display:'none'" <? php }?> >Col for view 1 only name
Have fun!(:
The three views are for security reasons *(each user only has access to certain views and functions) so I think you are right, doing it server side will be best. I will still need to add columns before the table draws each row as the functionality is different for each user as well depending on data in the row!
I wish I was doing this in PHP. Unfortunately, it's all vbscript and there is no time/budget for a re-write. All I've been bale to do is make it look a LOT better and Datatables has been a big part of that!
Cheers
Andy