EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: madstudio on December 17, 2015, 07:09:32 PM



Title: Datagrid Hide Rows
Post by: madstudio on December 17, 2015, 07:09:32 PM
I found really simple to hide Columns in Datagrid, but I can't find a way to hide specific Rows in datagrid based on certain conditions, such as Numbers, Colors, Titles, or whatever you lodge in the external MySQL table.

Example:
Any value in Row = "Apple" = Hide this Row.
Cheers!




Title: Re: Datagrid Hide Rows
Post by: jarry on December 17, 2015, 11:40:17 PM
You can use the datagrid filter extension to filter rows based on filtering rules. Please refer to http://www.jeasyui.com/extension/datagrid_filter.php
Code:
$('#dg').datagrid({
filterRules:[{
field:'productname',
op:'notequal',
value:'Apple'
}]
}).datagrid('enableFilter');


Title: Re: Datagrid Hide Rows
Post by: madstudio on December 19, 2015, 10:28:35 PM
Thank you  Jarry for your answer.

The datagrid filter extension works very well, but due to there is no way to avoid to get a filter cell under every single column title, is not really functional.

The goal is to get a simple filter in a combobox, similar to the Demo example "DataGrid Complex Toolbar"  but instead to filter and display "equals", the filter should display "Not equal" , sort of inverted filter.

I have also try this suggested by stworthy, but it did't work. if there is a chance to see an example in http://jsfiddle.net would be great.

Code:
var cc = $('#cc');  // the combogrid object
var opts = cc.combogrid('options');
var values = cc.combogrid('getValues');
var rows = [];
$.map(cc.combogrid('grid').datagrid('getRows'), function(row){
if ($.inArray(row[opts.idField], values) == -1){
rows.push(row);
}
});
console.log(rows)