jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Grid: Filter Row: Drop down option line height
Tagged: createfilterwidget, DropDownList, filter, grid, itemHeight, jqxDropDownList, jqxgrid
This topic contains 3 replies, has 2 voices, and was last updated by Dimitar 10 years, 6 months ago.
-
Author
-
Hi JQX Team,
I am using JQXGrid and have enabled filter row. I am trying to set my custom line-height to droop down options in one of filter header column.
The JQXGrid internally uses JQXDropdownlist which uses JQXListbox and list box has property ‘itemHeight’.I set this property inside column’s callback ‘createfilterwidget’ like below:
var createListBoxFilterWidget = function (column, columnelement, widget) {
var listbox;
if(column.filtertype === ‘list’ || column.filtertype === ‘checkedlist’){
listbox = widget.jqxDropDownList(‘listBox’);
} else if(column.filtertype === ‘number’){
listbox = widget.find(‘[role=”combobox”]’).jqxDropDownList(‘listBox’);
}
if(listbox){
listbox.itemHeight= 25;
listbox.refresh();
}
}The problem is, this refresh call removes default option of the filter column drop down like ‘please select’ and ‘select all’ from boolean drop down and checked list respectively.
Is there any other way where i can give this property while initializing the column like i give ‘showfilterrow’?
Is there any other method to call instead of refresh on list box?Regards,
Deepak PundirHello Deepak Pundir,
jqxDropDownList also has an itemHeight property so you can do the following:
var createListBoxFilterWidget = function (column, columnelement, widget) { widget.jqxDropDownList({ itemHeight: 25 }); }
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/This code just change the ‘itemHeight’ property but does not render the drop down according to this new ‘itemHeight’.
Please suggest.
Regards,
Deepak PundirHi Deepak Pundir,
The code works on our side. Here is the example we tested:
<!DOCTYPE html> <html lang="en"> <head> <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" /> <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxlistbox.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxdropdownlist.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxmenu.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.filter.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.sort.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.selection.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxpanel.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcalendar.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxdatetimeinput.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcheckbox.js"></script> <script type="text/javascript" src="../../jqwidgets/globalization/globalize.js"></script> <script type="text/javascript" src="../../scripts/demos.js"></script> <script type="text/javascript" src="generatedata.js"></script> <script type="text/javascript"> $(document).ready(function () { var data = generatedata(500); var source = { localdata: data, datafields: [ { name: 'name', type: 'string' }, { name: 'productname', type: 'string' }, { name: 'available', type: 'bool' }, { name: 'date', type: 'date' }, { name: 'quantity', type: 'number' } ], datatype: "array" }; var dataAdapter = new $.jqx.dataAdapter(source); $("#jqxgrid").jqxGrid( { width: 850, source: dataAdapter, showfilterrow: true, filterable: true, selectionmode: 'multiplecellsextended', columns: [ { text: 'Name', columntype: 'textbox', filtertype: 'input', datafield: 'name', width: 215 }, { text: 'Product', filtertype: 'checkedlist', datafield: 'productname', width: 220, createfilterwidget: function (column, columnelement, widget) { widget.jqxDropDownList({ itemHeight: 45 }); } }, { text: 'Available', datafield: 'available', columntype: 'checkbox', filtertype: 'bool', width: 67 }, { text: 'Ship Date', datafield: 'date', filtertype: 'range', width: 210, cellsalign: 'right', cellsformat: 'd' }, { text: 'Qty.', datafield: 'quantity', filtertype: 'number', cellsalign: 'right' } ] }); $('#clearfilteringbutton').jqxButton({ height: 25 }); $('#clearfilteringbutton').click(function () { $("#jqxgrid").jqxGrid('clearfilters'); }); }); </script> </head> <body class='default'> <div id="jqxgrid"> </div> <input style="margin-top: 10px;" value="Remove Filter" id="clearfilteringbutton" type="button" /> </body> </html>
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.