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]");
You can get the cell value from the model of a grid. Option 1: $("#grid"). data("kendoGrid").
field String. The field to which the column is bound. The value of this field is displayed in the column's cells during data binding. Only columns that are bound to a field can be sortable or filterable.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With