How to load dynamic data to grid

How to load dynamic data to grid

rakshitharakshitha Posts: 6Questions: 1Answers: 0

Hi,
How to bind jqGrid dynamically?. The columns are not available at design time but will only be available only at runtime.The columns are should be from database.Is possible?we can use ajax scripts also.

Regards,

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    This is the forum for DataTables. jqGrid is not the same as DataTables.

  • rakshitharakshitha Posts: 6Questions: 1Answers: 0
    edited November 2017

    then is possible to use data tables? without using column names,

  • kthorngrenkthorngren Posts: 21,303Questions: 26Answers: 4,947

    I built this simple example to build dynamic columns from the AJAX response:
    http://live.datatables.net/fafuyeyu/1/edit

    It builds the column names from the field names returned. But the AJAX response could contain a specific object with the column names.

    Kevin

  • rakshitharakshitha Posts: 6Questions: 1Answers: 0

    hi,

    This is fine,but i want to display column name from db,without giving HTML part,
    using server side processing,
    is possible?

  • kthorngrenkthorngren Posts: 21,303Questions: 26Answers: 4,947
    edited November 2017

    display column name from db,without giving HTML part

    Yes, you don't need to define the thead. You can remove that form the example and see that it works.

    using server side processing

    I believe with server side processing you need to define an ajax option within the Datatable config. You would then need to execute an external ajax request to get the column names before the Datatables initialization.

    Kevin

  • rakshitharakshitha Posts: 6Questions: 1Answers: 0

    Hi,

    i understand,but am beginner of datatables plugin,can u give with example

  • allanallan Posts: 63,464Questions: 1Answers: 10,466 Site admin

    http://live.datatables.net/cinomoni/1/edit

    That shows an empty table where the columns.title option is used to define the column headers. If you need to get that information via Ajax, you can do so with a simple $.ajax call.

    Allan

  • rakshitharakshitha Posts: 6Questions: 1Answers: 0

    Hi sir,
    i want to display large amount of datas to grid using serverside processing,you a gave sample example that is all fine sir,
    but i need to use without giving column name in html parts and ajax side also,
    is possible ?

  • allanallan Posts: 63,464Questions: 1Answers: 10,466 Site admin

    So you don't want to give the column information either in HTML, or in Ajax loaded data. Where do you want to give the column information then? The columns have to be defined somewhere.

    Allan

  • rakshitharakshitha Posts: 6Questions: 1Answers: 0

    Column name should be from database
    is possible in ajax loaded data?

  • allanallan Posts: 63,464Questions: 1Answers: 10,466 Site admin

    Yes - I gave an example of that above. You make an Ajax call to the server to get the column information. There would be a server side script which will get the information you want and send it back to the client.

    Allan

This discussion has been closed.