How to prepare a list of deleted kendo ui data with static elements

Maybe the name is not as clear as we would like. I use kendo ui for a contact management system, and I need to add the downloaded (via ajax) groups for a specific user, say "all contacts" with a value = -1 . this is the ability to delete all contacts that are actually a group but are not listed in the database. therefore, at the moment when the drop-down list finishes loading, we should have such parameters as (group 1, group 2, group 3 loaded from an ajax call, all contacts are added manually):

 all contacts group 1 group 2 group 3 

below is my code that works great when loading groups for the user.

 $("#groupCombo").kendoDropDownList({ placeholder: "all contacts", dataTextField: "NAME", dataValueField: "GROUP_ID", dataSource : { transport:{ read: { url: crudServiceBaseUrl+"subscribers/readgroups", dataType: "json", data: { userId: dataItem.USER_ACCOUNT_ID } } } } }); 

How can i achieve this? thanks for this.

+4
source share
1 answer

The data source has an insert function that inserts an instance of the new model into the data source.

 // insert a new model item at the very front of the collection $("#groupCombo").data('kendoDropDownList').dataSource.insert(0, { GROUP_ID: -1, NAME: "all contacts" }); 
+4
source

All Articles