Hi ,I have richselect view with options.I want to adjust the width of the options list based on the data width.Can any please help me out this?
Hi, you can get the width of the biggest item value with the help of a webix.html.getTextSize method.
Then you’ll need to define this width before suggest is shown. Check the snippet, please: http://webix.com/snippet/58254c68
hi, thank you for your response it is working fine.I want to load the options dynamically in that case how to do?
You can use url
instead of data
in this configuration.
To reload the options, you need to access the list and use its loading methods like parse(data)
or load(url)
, e.g.: http://webix.com/snippet/8329e079
Hi,it is working fine,but it is not working when I am pushing data dynamically to the option list.
Here I am sharing the snippet for the same (please find the comments in the snippet for the description)
http://webix.com/snippet/1d52c901
You don’t need to define empty options (options:[]
) in the richselect constructor. Due to this line a customized suggest list is not initialized and the onBeforeShow
handler is not called.
You can either omit empty data definition, of set data:[]
in the suggest constructor: http://webix.com/snippet/87acb430
Hi Helga ,I tried the same solution which you shared but I am getting error of "Uncaught TypeError: undefined is not a function " at the line
var width = webix.html.getTextSize(texts, “webix_list_item”).width+20;
Please help me out this.
Please check Webix version in use. The method was introduced in the latest release, the 3.1.
I am using 3.0 version
You can download the latest version from the site.
Can you please suggest some other solution so that I can make use of the currently working webix version(which I am using now)
Version of 3.1 is fully backward compatible. So you can just update js files without any changes in the codebase.
You can try to replace “richselect” with “select” conrol. The “select” will use native “select” control and will size the popup list to the size of content automatically.
Unfortunately, version 3.0 doesn’t have any other functionality, that can be used to size elements to a content.