jquery - Is there a smart and universal solution for using datatables.js with relational SQL table -


couple of days i'm trying build server side processing table grid datatables.js , relational sql table.

what means ?

i have master table (with few joins), example

select      m.id,      m.date,      u.name,      t.name,     case m.type when 1 'some value 1' when 2 'some value 2' end master m left join users u on m.user_id = u.id left join test t on m.test_id = t.id .... 

everything ok, main problem appears on searching etc... first of all, can decide how store data json datatables, accessing field names or table prefix + field names

$(".dt").datatable({    "bserverside": true,    "sajaxsource": "/items/show",    "sajaxdataprop": "data",    columns: [        { data: "m.id" },        { data: "m.date" },        { data: "m.type" },     etc .... }); 

that's ok, when try search values type field must write whole procedure processing "ssearch", "ssearch_0", "ssearch_1" ... "mfield_1", "mfield_2", etc ... know, programmers lazy sort of people , make non-repetitive , intuitive , can used more once.

that's not problem, not unique task can write code , fertig!, there more situations must used, same scenarios etc...

i'm wondering there better this, because i'm using datatables admin backend in portal find it's beast single table (users, rules, topics... etc.) complex solution , i'm interested in solutions such problems.

is there different solution type of tasks besides datatables plugin.

problems can done datatables in variant put data in dom, so

<tr> foreach( records rec )     <td>rec->id</td>     <td>rec->name</td>     if bla bla bla        <td>some value</td>     ...     etc ...    </tr> 

and initialise datatables on table object. search locally in dom , ok. great solution small amount of data, must handle 1.000.000 or more rows , because of i'm choosing "server side processing".

thanks


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -