filter()
filter()
Hi, I am using the following code to load a table:
function addRowDT(data) {
var tabla = $('#tbl_PedidosGraf').DataTable()
for (var i = 0; i < data.length; i++) {
tabla.row.add([
data[i].IdPedidosGraf,
data[i].Grafica,
data[i].Estado,
data[i].FechaEnviado,
data[i].Presupuesto,
data[i].Cliente,
data[i].Detalle,
data[i].FechaPapel,
data[i].PliegosCant,
data[i].Formato,
data[i].Sustrato,
data[i].Impresion,
data[i].Piezas,
data[i].FechaImpreso,
data[i].FechaRetirado,
data[i].InfoAdicional
]).draw(false);
}
}
and I need to filter it by the vector [Estado], how can I do?
Tanks, David
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
One option is to use
column().search(). If this doesn't help then please provide more info of how exactly you would like the table search to work.Kevin
I manage to filter and show:
preview:
Array(3)
0: {type: "_04_Entidades.PedidosGraf", IdPedidosGraf: 9, Grafica: "MDC Impresiones", Estado: 1, FechaEnviado: "20/11/2019 0:00:00", …}
1: {__type: "_04_Entidades.PedidosGraf", IdPedidosGraf: 10, Grafica: "Sorgraf", Estado: 1, FechaEnviado: "25/11/2019 0:00:00", …}
2: {__type: "_04_Entidades.PedidosGraf", IdPedidosGraf: 11, Grafica: "MDC Impresiones", Estado: 1, FechaEnviado: "20/11/2019 0:00:00", …}
length: 3
__proto: Array(0)
I need to show that result in the table.
tanks
The
filter()API doesn't affect the table. Did you trytabla.column(2).search(1).draw()?Kevin
Thanks Kevin, it worked!