Last Updated: 11 Dec 2019 09:03 by ADMIN
Created on: 18 Apr 2017 07:14
Category: DropDownList
Type: Feature Request
Add support for custom data-* attributes on the <option> tag in kendoDropDownList
Currently the data-* attributes on the <option> tags are removed by the kendoDropDownList widget.
Please pass them through so they can be used.

After searching the kendo.all.js I found that there is currently no way the custom data-* can be added into the generated html code.

I'm using MVVM for a rather large SPA. Some parts of the SPA is generated on the server (webservice) which is just a partial html. Which looks like (simplest one):
<select data-role="dropdownlist" name="ProductTypeID" class="k-textbox">
	<option value="9" data-cond="DependsValue(ProductTypeCategoryID,1)">Compliments cards</option>
	<option value="1" data-cond="DependsValue(ProductTypeCategoryID,1)">Flyers</option>
	<option value="3" data-cond="DependsValue(ProductTypeCategoryID,3)">Brochures</option>
	<option value="25" data-cond="DependsValue(ProductTypeCategoryID,6)">Roll-up banners</option>

In this case the data-cond is an attribute in which there is a (javascript) function that should be run to determine if this option is valid or not (it is made hidden if not).

I was trying to convert this into a datasource which can be bound to the dropdownlist, but this has several drawbacks. The most important are:

- There are almost 60 different of these kind of dropdowns that can be generated from the server; This means a lot of extra code and webservices.

- Calling the webservice for each of them is way to slow since each field changes conditional values of other fields, and so the server would be called way to often. But on the client side this runs way faster. Even in javascript.

- The data-* attributes should be supported accordingly the html5 standard to my humble opinion :)

I found two questions regarding this, but both where unanswered.

I add them here for you comfort :)