jQuery UI Widgets › Forums › Lists › DropDownList › jqxDropDownList lazy load
Tagged: createfilterwidget, DropDownList, filter, filteritems, jqxDropDownList, jqxgrid, Lazy load, open, open event
This topic contains 8 replies, has 4 voices, and was last updated by Peter Stoev 9 years, 8 months ago.
-
Author
-
Hi, i would like to load the list, only when the user click to open it.
I already try loading the source with the event
widget.on(‘open’, function (event) {
widget.jqxDropDownList({ source: dataAdapter });
});And its working but! its not rendering all results! only one!
Like this:
[Filter^]
[One result only]This is for the Grid filters! in order to load only distinct values from the server!
Thanks.
Hello AFraga,
In this case we recommend you set your filter options in the column property filteritems, which can be an Array or a data adapter instance. If you, however, do not wish to use this property for some reason, please provide us with a larger code sample so that we may determine if there is anything wrong with your solution.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/The problem using filteritems property is that the url is being hitted twice per column!
And what i want is a “LAZY LOAD” or a “LATE LOAD”, that the dropdownlist get populated! only if the user open the filter!
Imagine that I have a JQXGrid with thousand of rows, and 10 columns! its not good that the server is beeing hit 20 times! specialy
if their are not going to filter any column!Thanks.
Here is a small code that i think is working but render bad the dropdownlist
Problem: My source bring arround 50 rows, the dropdownlist show only 5, without scrollbar.
var source = { cache: false, datatype: "xml",//<rows><row mycolumn="Value" />...</rows> datafields: [ { name: 'Label', map: function (obj) { return $(obj).attr("MyColumn"); }, } ], root: "Rows", id: "ID", record: "Row", processData: function (data) { //Set which column i need to populate the unique values in the dropdownlist return data; }, url: "../GetFilters.ashx" }; var dataAdapter = new $.jqx.dataAdapter(source, { async: false }); createfilterwidget : function (column, columnElement, widget) { widget.jqxDropDownList({ displayMember: "Label", valueMember: "Label", width: '100%', checkboxes: true, dropDownWidth: 300, animationType : 'none' }); widget.on('open', function (event) { widget.jqxDropDownList({ source: dataAdapter}); }); }
Hello AFraga,
filteritems expects Array and nothing else. If array is passed, there is no URL.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/•filteritems – sets the items displayed in the list filter – when the “showfilterrow” property value is true and the filter’s type is “list” or “checkedlist”. The expected value is Array or jqxDataAdapter instance.
I’m talking about the url of the jqxDataAdapter instance.
And I am telling you that if you want to display custom items in the filter widget you should use filteritems which accepts only Array.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/I don’t understand. He quoted the documentation exactly where it says “The expected value is Array or jqxDataAdapter instance.”
Is the documentation incorrect?
Hi Daniel H.,
There are samples and documentation which show how this works and show that it works. Example: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/grid-list-filter-with-key-value-column.htm?arctic. The user tries to create a custom filtering widget and implements createfilterwidget. There is absolutely no problem with filteritems.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.