Server Side custom depending on value

Server Side custom depending on value

huwadhuwad Posts: 5Questions: 1Answers: 0
edited April 2016 in Free community support

Hi, I want to use server side, because when I use client side and i get and loads tons of data from database it took a minute before the page loads completely, I tried server side and it resolves the problem.

the only thing I need to do is to customize <tr> on each of the row depends on their value,

for example I have loaded tables of licenses, I want to customize <tr> of expiring license so that the end user will classify it as expiring

e.g:
[ ID ] [ Name ] [ License No. ] [ Expiration ]

[ 1 ] [ USER1 ] [ LIC001 ] [ 07-07-2017 ]
[ 2 ] [ USER2 ] [ LIC002 ] [ 12-07-2016 ] <style tr to classify it as expiring>
[ 3 ] [ USER3 ] [ LIC002 ] [ 20-03-2017 ]
[ 4 ] [ USER4 ] [ LIC002 ] [ 18-04-2017 ]
[ 5 ] [ USER5 ] [ LIC002 ] [ 30-05-2017 ]
[ 6 ] [ USER6 ] [ LIC002 ] [ 08-06-2017 ]
[ 7 ] [ USER7 ] [ LIC002 ] [ 05-07-2017 ]

This question has accepted answers - jump to:

Answers

  • huwadhuwad Posts: 5Questions: 1Answers: 0

    Hi? anyone can help me please? I just want to style the background of specific tr's depending on their value

  • allanallan Posts: 62,116Questions: 1Answers: 10,185 Site admin
    Answer ✓

    Use rowCallback to customise the tr element (.e.g adding a class).

    Allan

  • huwadhuwad Posts: 5Questions: 1Answers: 0

    thanks allan.. ill look for it

  • huwadhuwad Posts: 5Questions: 1Answers: 0

    I solved this using rowCallback, but I still have another question styling td I use this code

    "rowCallback": function( row, data, index ) {
    if (data[1]<data[2]) {
    $('td', row).css('background-color', '#ff5559');
    }

    here is the question,

    what if I will get data and compare it to data[1] from the database that is not displayed on the table. is it possible?

    for example I will get data's from another table with specific ID I define to compare it in data[1] and style a td..

  • allanallan Posts: 62,116Questions: 1Answers: 10,185 Site admin
    Answer ✓

    what if I will get data and compare it to data[1] from the database that is not displayed on the table. is it possible?

    Yes - you can get the data from anywhere you want. Just obtain it as you would from anywhere else - $('#myId').text() for example.

    Allan

  • huwadhuwad Posts: 5Questions: 1Answers: 0

    thanks allan.. your the man

This discussion has been closed.