Help using data tables

Help using data tables

mubharadmubharad Posts: 2Questions: 1Answers: 0

Hi,

I'm trying to use datatable to sort some of my datetime related data and i can't get it to work.

When the webapp comes up, by design, it has only the table column names and upon invoking a service, it gets filled with the appropriate data. However there's no border for the column names that will enable sorting. I've included necessary css & js in the page and followed the examples to use the feature.

Does datatable work only with static prefilled tables and not dynamically created ones? Or am I missing anything in my code/configuration?

Thanks in advance.

Answers

  • larsonatorlarsonator Posts: 54Questions: 4Answers: 2

    Hi, DataTables should work with what ever table to set it on no matter how it was made.

    If you are starting with an empty table, (just the headers), you will need to set a source to get the data from, and follow the API to ensure that the source comes through in the correct format (otherwise, DataTables wont be able to work it out).

    If nothing is coming up in basic configuration, double check your scripts, make sure you have jquery loaded before DataTables, as it is a jquery plugin,
    and also make sure you have the css loaded.

    if you could post a jsfiddle or some code within < pre > </ pre > tags, this would be a lot more helpful to help diagnose what is going on.

  • mubharadmubharad Posts: 2Questions: 1Answers: 0

    Thanks for your reply and really sorry that i'm responding after a long gap. I got datatables to load now (js & css were not getting loaded via appContext setting), finally had to use internet url to get it working.

    However i've another problem now. I can see data in table, but sorting and searching doesn't work. One of the column for sorting is datetime with data like 2014-08-23T10:30:00.000-06:00. Is the data the reason why sorting is not working? Even searching for particular date doesn't work.

    Am I doing anything wrong? Thank you again for your help.

This discussion has been closed.