Displaying server data pulled from a Form submission

Displaying server data pulled from a Form submission

hsajjadhsajjad Posts: 28Questions: 0Answers: 0
edited February 2014 in General
The use case is simply to capture few search params from user, submit them to the server that query/filter based on those params and send JSON data back to the datatables to display.

Most examples I've come across use sAjaxSource, which kind of behaves different to my classic use case. Are there any examples that I'm missing out?

Thanks in advance!

Replies

  • hsajjadhsajjad Posts: 28Questions: 0Answers: 0
    Alternatively, I may able to utilise the sAjaxSource attribute if I can subordinate this to the Form submission call, i.e. execute once the user hit 'submit' and pass the entire Form data. Is this how its usually done or a bit crazy?

    Thanks
  • hsajjadhsajjad Posts: 28Questions: 0Answers: 0
    edited February 2014
    Any suggestions?

    Here's how my code is looking like after engaging the datatable rendering to my Form submission event. Apparently this works ok and I can trace the JSON is getting feteched OK from server side but the issue is that I don't see it being displayed on my datatable.
    [code]
    $(document).ready(function() {
    $('#form_id').submit( function() {
    var sData = $('input').serialize();

    $('#table_id').dataTable( {
    "bProcessing": false,
    "bServerSide": true,
    "sAjaxSource": "query.do?"+sData,
    "aoColumns": [
    { "mData": "busId", "bSortable": false },
    { "mData": "sourceSystem", "bSortable": false },
    { "mData": "receiveTime", "bSortable": false,
    "mRender": function(data, type, full) {
    return new Date(data).toUTCString();
    }
    },
    { "mData": "recipients", "bSortable": false},
    { "mData": "validationStatus", "bSortable": false },
    { "mData": "routingStatus", "bSortable": false },
    { "mData": "messageId", "bSortable": false }
    ],
    "fnServerData": fnDataTablesPipeline,
    "sDom": "rtp",
    "sPaginationType": "full_numbers",
    "iDisplayLength": 20
    } );

    return false; // cancel the form submit action as we do this via ajax
    } );
    } );


    [/code]
  • hsajjadhsajjad Posts: 28Questions: 0Answers: 0
    Hi,

    What's is the average response time on this forum? It seems to be taking 30+hrs without a single reply!
This discussion has been closed.