Server-side processing

Server-side processing

TrollchikTrollchik Posts: 80Questions: 1Answers: 0
edited September 2011 in General
Hello.
I'm using the server - side processing and i need to put aligning data for TD. I need that exist parameter like DT_RowClass. But how can i use the aligning inside TD ???

thanks

Replies

  • TrollchikTrollchik Posts: 80Questions: 1Answers: 0
    The problem that i need to apply defferent alignment for different columns! so i need to apply different classes to different columns!
  • allanallan Posts: 63,530Questions: 1Answers: 10,473 Site admin
    For column,s what you probably want is sClass in that case: http://datatables.net/ref#sClass . That will apply that class to all the target columns.

    Allan
  • TrollchikTrollchik Posts: 80Questions: 1Answers: 0
    i mean i need to apply the different classes to different separate cell. For example in one row i can apply a few classes to different cells. Also it will be convinnient to do it using server-side processing like with DT_RowClass.
  • GregPGregP Posts: 500Questions: 10Answers: 0
    I still don't see how sClass wouldn't work; if it's about convenience, it's the more convenient option in my eyes, rather than having to hack markup into the data. But that's just my opinion.

    That failing—and possibly an even better-performing option—would be to do it with CSS. You should know in advance what your table is going to look like, so with CSS you can simply write a rule like:

    [code]
    td:nth-child(4n+1) { text-align: right }
    [/code]

    (you'll need to look up nth-child docs/tutorials to figure out exactly which rules to write)
  • TrollchikTrollchik Posts: 80Questions: 1Answers: 0
    No, i don't have how my table will look, bcs i use dataTables in the jsp and the number of columns depends on settings.

    [code]


    YTM BGHT%




    PUR_ DATE


    [/code]

    so i don't know which columns i have and what classes i have to apply to cell, bcs it's depends on the settings. So i need to assign class to cell on the server side.
  • TrollchikTrollchik Posts: 80Questions: 1Answers: 0
    anybody help please.... it will make my ptoject faster at any times!
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    use one of the callbacks (i.e. fnRowCallback) and change classes. that callback will give you access to a DOM (as nRow). just iterate over the columns and see if you need to apply any CSS to any of the cells or the entire row.

    http://www.datatables.net/ref#fnRowCallback
This discussion has been closed.