Title: DataGrid Filter-Row label text
Post by: WizPS 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 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!
Title: Re: DataGrid Filter-Row label text
Post by: jarry on September 28, 2020, 07:47:38 PM
Please call 'getFilterComponent' method to get the target object and then change its content. var c = dg.datagrid('getFilterComponent', 'men'); c.html('myLabelText')
Title: Re: DataGrid Filter-Row label text
Post by: WizPS on November 07, 2020, 08:13:16 AM
Perfect, thanks Jarry!
|