Adding an extra column when using server side

Adding an extra column when using server side

MikeEastMikeEast Posts: 2Questions: 0Answers: 0
edited September 2010 in General
I am using datatables 1.7.2 and server side execution.

I get 11 columns from my server side object and need to add a column with check boxes having its value set to the value of one of the 11 properties in my server side object.

How would do that?

Thanks!

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    In the script here ( http://datatables.net/development/server-side/php_mysql ) it indicates where you might want to add extra columns (the text "Optional Configuration"). You can add your HTML checkbox there and that will do the business.

    Allan
  • MikeEastMikeEast Posts: 2Questions: 0Answers: 0
    Hello Allan,

    I am using ASP.NET MVC and my server side object should not change in order to accomplish this, I think.

    It is a ViewModel but do I really have to add, say an extra ID column, just to feed a checkbox column?

    Aren't there a way to get an extra column using client side config?

    Cheers!

    ::m
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Sure there is :-). Use fnServerData ( http://datatables.net/usage/callbacks#fnServerData ) to go through the returned array and for each row returned add the column with the value you want.

    Allan
  • izmotoizmoto Posts: 1Questions: 0Answers: 0
    edited September 2010
    Hi Allan,

    regarding ..."Sure there is :-). Use fnServerData ( http://datatables.net/usage/callbacks#fnServerData ) to go through the returned array and for each row returned add the column with the value you want.",...

    Kindly provide a sample - i can't seem to figure it out on my own.

    Thanks.
  • fiififiifi Posts: 2Questions: 0Answers: 0
    edited October 2010
    Hi MikeEast,

    You can check out this simple work around I made for adding an extra column. It is located at: ( http://fbta.tumblr.com/post/1374357393/adding-extra-columns-in-jquery-datatable )
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Nice one fiifi! Thanks for writing that up - I'm sure I'll be linking to it in future! I've added your post to the DataTables news feed as well ( http://datatables.net - at the bottom right )

    Regards,
    Allan
  • joseandrew777joseandrew777 Posts: 3Questions: 0Answers: 0
    Excume, I have a cuestion too. I need to add a column to my table. The table only accept 5 columns. How can I do that?
    I need your help, please
    Regards, ANdrew
  • joseandrew777joseandrew777 Posts: 3Questions: 0Answers: 0
    I have the code:


    <?php echo $Fila['nrocite']; ?>
    <?php echo $Fila['ingreso']; ?>
    <?php echo $Fila['c_cod_resp']; ?>
    <?php echo $Fila['d_fecha_resp']; ?>
    <?php echo $Fila['c_cod_cite']; ?>

    I need to add a 4 columns, how can i do than. I got my values of php code.
    I need more columns, Allan, please I need your help.
    Regards Andrew
This discussion has been closed.