do not show row if id in list
do not show row if id in list
painxurek
Posts: 3Questions: 0Answers: 0
i want to check if id in crawled list if so do not render that row any help
json
{
data: [
{
id: 20,
title: "Monster House",
image_file: "http://127.0.0.1:7000/images/99969.jpeg"
}],
crawled: [1,5,20]
}
ajax
let table = $('#ecommerce-product-list').DataTable({
"processing": true,
"serverSide": true,
"ajax": {
"url": "/mage/ajax_mage_all/",
"type": "GET"
},
"columns": [
{data: "id"},
{data: "image_file"},
{"data": "title",
className:"text-center"
},
]
});
Replies
Since you are using server side processing (serverSide: true) your server script will need to filter the rows you don't want displayed. Are you using Datatables supplied server side processing scripts or your own?
Kevin
i'm trying to avoid filtering using server side if possible
When you have server side processing all searching, sorting and paging functions are performed by the server script. There is no option for performing filtering in the client. Maybe you can use client side processing?
One option, which is not supported by Datatables, is to use something like jQuery hide() to hide the row elements in the DOM. You can use the
draw
event to loop through all the rows in the client usingrows().every()
. In the loop do your comparison and hide the matching rows with jQuery hide().One caveat is that Datatables knows nothing about using jQuery hide(). If you have a page length of 10, for example, and hide one row the table will display only 9 rows.
Kevin
alright i'll try server side then , tnx for explain