Hi,
I'm using datatables, its very good. But I have a little problem with MVC (MVP) Model-View-Presenter model, because I'm using server-side procesing with PHP and I must specify output for row in Presenter, eg:
Do you think, is possible to use it in template like with ColdFusion (but only with PHP, HTML, jquery...)
template:
And jquery in datatable in first run get the first row and save in as template for row. If it get data by json (must be set as associated array, not by sequence), replace data in template row and draw each row by this template.
I think, is very usefull for styling and logic.
If you give me some advice, I can try it and add this functionality to datatables for all.
I'm using datatables, its very good. But I have a little problem with MVC (MVP) Model-View-Presenter model, because I'm using server-side procesing with PHP and I must specify output for row in Presenter, eg:
foreach ($items as $id => $item) { $row = array(); $row[] = '<a class="ajax wC" href="' . C::getLink('Employer', 'detail', $item->id) . '" title="Detail">' . $item->employer_user_surname . ' ' . $item->employer_user_name . '</a>'; $row[] = $item->date; $row[] = $item->name; $row[] = $item->count; $row[] = F::getPrice($item->cost); $row[] = $item->note; // add actions $row[] = '<a class="ajax ' . $this->ajaxTarget . ' actionEdit" href="' . C::getLink($this->getBaseName(), 'edit', $item->id, $h->params) . '" title="Edit">Edit</a> <a class="ajax ' . $this->ajaxTarget . ' actionDelete" href="' . C::getLink($this->getBaseName(), 'delete', $item->id, $h->params) . '" title="Delete">Delete</a> '; $output[] = $row; } $h->params['output'] = $output;
Do you think, is possible to use it in template like with ColdFusion (but only with PHP, HTML, jquery...)
template:
<table class="display wDataTable" id="example"> <thead> <tr> <th width="20%">Name</th> <th width="10%">Date</th> <th width="20%">Subject</th> <th width="5%">Count</th> <th width="5%">Price</th> <th width="20%">Note</th> <th width="10%">Action</th> </tr> </thead> <tbody> <tr> <td>#item.name #item.surname</td> <td>#item.date</td> <td>#item.subject</td> <td>#item.count</td> <td>#item.price</td> <td>#item.note</td> <td><a class="ajax actionEdit" href="#item.urlEdit" title="Edit">Edit</a></td> </tr> </tbody> </table>
And jquery in datatable in first run get the first row and save in as template for row. If it get data by json (must be set as associated array, not by sequence), replace data in template row and draw each row by this template.
I think, is very usefull for styling and logic.
If you give me some advice, I can try it and add this functionality to datatables for all.