Following table design possible? Server Side Processing

Following table design possible? Server Side Processing

VrutinVrutin Posts: 14Questions: 0Answers: 0
edited November 2013 in General
Hey, Guys

Is the following possible to do with server side processing:
http://awesomescreenshot.com/0351zti29d

Basically bring record twice, but information changes in the two rows.

Thanks in advance,
Regards

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Not really in 1.9, but in 1.10 (which is heading towards beta soon!) the child row options have been improved, so yes it would be possible there. You'd need to do a little bit of coding to get it to work.

    The documentation for how the child rows in 1.10 is written, but not yet published. However, the final example in this file might help: https://github.com/DataTables/DataTablesSrc/blob/1_10_wip/docs/api/row().child().xml

    Allan
  • VrutinVrutin Posts: 14Questions: 0Answers: 0
    edited November 2013
    Hi, Thanks

    Will look into it

    Regards,
    Vrutin
  • VrutinVrutin Posts: 14Questions: 0Answers: 0
    How can I return data as associative pair? Currently I am getting in the following way:

    [code]
    {
    "aaData": [
    [
    "10131",
    "Ultrasonic Cleaner",
    "AT,BE,DK,FI,FR,DE,IE,IT,NL,NO,NOVO,PT,ES,SE,CH,UK",
    "test.test",
    null,
    "0",
    "1",
    "1",
    null,
    null,
    null,
    null
    ]
    ]
    }
    [/code]
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    You can return it any way you want and then use mData to have DataTables consume the data: http://datatables.net/blog/Extended_data_source_options_with_DataTables
  • VrutinVrutin Posts: 14Questions: 0Answers: 0
    I am using the following PHP file for my ajaxsource:
    http://datatables.net/release-datatables/examples/data_sources/server_side.html

    what would I change in that php file you created allan?

    Regards,
    Vrutin
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Nothing I don't think - other than to have it read your database. All the configuration you need to do would be done on the client-side in Javascript using the row details, like in the example I linked to before.

    Allan
  • VrutinVrutin Posts: 14Questions: 0Answers: 0
    edited November 2013
    [code]/* Array of database columns which should be read and sent back to DataTables. Use a space where
    * you want to insert a non-database field (for example a counter or static image)
    */[/code]

    When using space it returns the following in Ajax response:

    $aColumns = array(" ", "job_no", "job_name", "region");

    Ajax Error: Unknown column '' in 'field list'

    Regards,
    Vrutin
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hmm - try an empty string... Its been a while since I've worked with that script!

    Do you actually need server-sid processing btw? How many rows are you using? You should only need server-side processing if you are using >50'000.

    Allan
  • VrutinVrutin Posts: 14Questions: 0Answers: 0
    Hi, I tried before with zero configuration and was generating rows through php while loop.
    However, it took more 20 seconds for page to load and sometimes the browser didn't respond.

    This is the reason I moved to Server side.

    I have tried an empty string. However, that seems not to be working either. Just shows the same error as posted above.

    Regards,
    Vrutin
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Yup - looking at that script, it looks like there isn't the str_replace that would be needed for the space to be correctly handled.

    To be honest, I would recommend forgetting that script and using one for objects instead: https://github.com/DataTables/DataTables/blob/master/examples/server_side/scripts/objects.php . Use mData as described in the blog post I pasted above, then you don't need to use space in the column list at all.

    Allan
This discussion has been closed.