I need to get a row(s) from my kendo grid, using a string as parameter to filter rows. the grid model is:
{
id: "id_tipo_pagamento",
fields: {
id_tipo_pagamento: { type: "number", editable: false },
desc_tipo_pagamento: { type: "string"}
}
i tried this, but isn't working:
var grid = $("#kendoGrid").data("kendoGrid");
var row = grid.tbody.find("tr[desc_tipo_pagamento=test]");
Instead of using DOM, I would suggest using jQuery.grep
on the DataSource.data
array (if you want all) or in DataSource.view
if you want from the current visible ones.
Example:
// Retrieve all data from the DataSource
var data = grid.dataSource.data();
// Find those records that have desc_tipo_pagamento set to "test"
// and return them in `res` array
var res = $.grep(data, function (d) {
return d.desc_tipo_pagamento == "test";
});
res
will contain a reference to the records in DataSource that matched the condition.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.