merge 2 datalist to datatable

merge 2 datalist to datatable

joon49joon49 Posts: 12Questions: 2Answers: 0

hello,

i have two databases with the same structure

and i want show the two data in an single datatable.

how can i proceed pls?

thanks in advance

Replies

  • kthorngrenkthorngren Posts: 21,196Questions: 26Answers: 4,926

    There are lots of ways to do this. A couple options are:

    1. Merge the data together in your server script to return as one JSON response
    2. Fetch the two data sets via Ajax and use rows.add() for each data set to populate the table

    Kevin

  • joon49joon49 Posts: 12Questions: 2Answers: 0

    can I have an example pls?

  • kthorngrenkthorngren Posts: 21,196Questions: 26Answers: 4,926

    Here is one option using jQuery ajax() to fetch the two dat sets:
    http://live.datatables.net/forazake/1/edit

    The example uses the same URL and you will see duplicate data. You will use different URLs.

    Kevin

  • joon49joon49 Posts: 12Questions: 2Answers: 0

    how Merge the data together in your server script to return as one JSON response?

    thanks in advance

  • kthorngrenkthorngren Posts: 21,196Questions: 26Answers: 4,926

    You will need the row data in an array as described in the Data docs. If using ajax then the Ajax docs will have more useful information.

    How to combine the two data sets into one array is dependent on the server language you are using. You likely will be able to find suggestions on Stack Overflow for merging to arrays.

    Kevin

Sign In or Register to comment.