EasyUI Forum
April 25, 2024, 12:21:52 PM *
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 Filter-Row label text  (Read 2964 times)
WizPS
Jr. Member
**
Posts: 67


View Profile
« on: September 27, 2020, 05:05:08 AM »

Using the datagrid enableFilter I would like to add a text to the label, or actually a button. My code is now

Code:
function dg_filter_bar(dg) {
if (!dg.length) { dg = get_dg_index(dg)[0] }
var dg_options = dg.datagrid('options');
if (dg.datagrid('isFilterEnabled')) {
dg.datagrid('removeFilterRule').datagrid('disableFilter').datagrid('reload');
return;
}
var cols = JSON.parse(JSON.stringify(dg_options.columns[0]));
cols.splice(0, 1);
cols.splice(cols.length - 1, 1);
///*
var zFilterRow = [];
$.each(cols, function (i, o) {
var options;
if (o.title === "" || o.field === "") { return true; }
options = dg_fld_options(dg, dg_options, o);
zFilterRow.push({
field: o.field
, type: 'combogrid'
, options: options
});
});
zFilterRow.push({ field: 'edt', type: 'label' });
zFilterRow.push({ field: 'men', type: 'label', text:'myLabelText' });
zFilterRow.push({ field: 'del', type: 'label' });
dg.datagrid('enableFilter', zFilterRow);
// */
}
giving result as in attached pic. However my text "myLabelText" wont show-up.
Thanks for advice!
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: September 28, 2020, 07:47:38 PM »

Please call 'getFilterComponent' method to get the target object and then change its content.
Code:
var c = dg.datagrid('getFilterComponent', 'men');
c.html('myLabelText')
Logged
WizPS
Jr. Member
**
Posts: 67


View Profile
« Reply #2 on: November 07, 2020, 08:13:16 AM »

Perfect, thanks Jarry!
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!