EasyUI Forum
January 25, 2026, 08:34:14 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Datagrid Hide Rows  (Read 11458 times)
madstudio
Newbie
*
Posts: 8


View Profile
« 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!


Logged
jarry
Administrator
Hero Member
*****
Posts: 2305


View Profile Email
« Reply #1 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');
Logged
madstudio
Newbie
*
Posts: 8


View Profile
« Reply #2 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)


« Last Edit: December 19, 2015, 10:32:16 PM by madstudio » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!