Control over row rendering\painting

Control over row rendering\painting

jacksheepjacksheep Posts: 2Questions: 0Answers: 0
edited January 2011 in General
Hia,
I'm kinda new to DataTables, and would like to know if the following is possible (would appreciate any leads) :

I wish to have a table where I have complete control over how each row is rendered - unlike the grid structure that regular tables have (where each data item always appears in a grid cell), I want to manually construct the visual contents of each row (say, have my own little table covering the entirety of each row, and place the data items of that row in that little table in some arbitrary way).

Is that possbile with DataTables?
What would be a good way to go about it?

Thanks!

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    No this isn't something that DataTables was designed to do. DataTables is fairly rigid about how layout is done - and it's on a traditional row->cell basis in a table, rather than just a cell basis which can be placed anywhere. This assumption is something that is built into the core of DataTables quite tightly, so there would be a lot of work allowing (for example) filtering to work on a per cell basis, hiding individual cells rather than rows.

    Allan
  • jacksheepjacksheep Posts: 2Questions: 0Answers: 0
    edited January 2011
    I'm not sure that I follow, let me rephrase my need more precisely:

    Have a table with sorting+filtering+pagination, but: within every row, instead of showing
    [code]
    +--------+--------+--------+
    | X | Y | Z |
    +--------+--------+--------+
    [/code]
    I wish to show
    [code]
    +--------------------------+
    | bla bla X bla Y bla Z |
    +--------------------------+
    [/code]
    (i.e. some html div that will show the row's data the way I want it to show it)
    ...

    Does your answer still apply?
    Thanks

    Jack
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Hi Jack,

    I had been thinking that it might be something like this:

    [code]
    +--------+--------+--------+
    | A | B | C |
    +--------+--------+--------+
    | D | E | F |
    +--------+--------+--------+
    [/code]
    and become something like this after filtering (i.e. moving cells around):

    [code]
    +--------+--------+
    | A | C |
    +--------+--------+
    [/code]
    However, what you want is more achievable, if I understand correctly. So you wish to combine the information in the columns into a single column table? What you could do is have an empty column and then hide all the other columns with the information in them - then use fnRowCallback to put the data you need into the visible column. It wouldn't allow sorting though of course, since you can see the data columns to sort on them (unless you provide hooks to do it which is also possible).

    Allan
This discussion has been closed.