Images Side By Side - return json/php server-side
Images Side By Side - return json/php server-side
Hello people.
I'm starting to work with dataTable.
Actually i have one input for search, the search send a post form in my archive request.php.
In response of request.php, I get the html/json the structure below:
<code>
<tr>
<td><img src="/img/1.jpg"></td>
<td><img src="/img/2.jpg"></td>
<td><img src="/img/3.jpg"></td>
<td><img src="/img/4.jpg"></td>
</tr>
<tr>
<td><img src="/img/5.jpg"></td>
<td><img src="/img/6.jpg"></td>
<td><img src="/img/7.jpg"></td>
<td><img src="/img/8.jpg"></td>
</tr>
</code>
After response, I just append:
$.ajax({
type: "post",
url: "request.php",
dataType: 'json',
data: {
query: queryInput,
},
success: function (response) {
('#my_table-response').append(response);
}
});
Imagine that result return 80 images and I need show the pagination of imagens side by side (12 images / 3 rows / 4 columns)
How to do this ?
Anyone can help-me, please ?
Thank you so much!
Answers
DataTables isn't really suited for that sort of grid display. You could do it as you have and then initialise the DataTable after you've run the
append
line, but really, you'd be better using flex-box for that sort of layout.Allan