Setting Value and Suggest on Multiselect in ActiveContent

HI,

I am trying to use a Multiselect in an ActiveContent list item. I have use ActiveContent for many other controls such as text and toggles and they all work great; however, I am having a lot of difficulty with Multiselects and Multicombos as ActiveContent.

This is an example of what I am trying to do:
https://webix.com/snippet/8f688da7

In my actual implementation, I have several other ActiveContent controls such as toggles and text fields, that all work great. It is difficult to show the full extent in this snippet of how I have been trying to get the Multiselect control to work. We are actually using a model to keep track of data items, instead of plain JSON. I've attempt trying to get the Multiselect to show the proper value and suggest with some event listeners

on:{
'onBeforeRender': function(){
let itemId = grouptest.editModeItemId;
if(!this.getPopup()) {
//to prevent stack overflow because of invinite rendering due
to setValue
this.setValue(grouptest.items.getItem(itemId).selectedTags);
}
this.define('suggest', {
selectAll:true,
body:{
data: grouptest.items.getItem(itemId).allTags,
},
value: grouptest.items.getItem(itemId).selectedTags
});
}
}

We only ever have one list item in editMode at a time. The first time we show the Multiselect on a list item, it works well but switching edit mode to a different list item still shows the first list item's suggest list at first. I also am running into strange bugs of selecting an item on the Multiselect and it setting the value to have be two of the items instead of the one I clicked, or not updating the value at all.

Any guidance on how to use Multiselect (or Multicombo) as ActiveContent would be greatly appreciated.

Comments

  • Hello!
    You can read more about ActiveContent on our blog
    Here is an example using Multiselect as ActiveContent

  • Thank you for your response, Nastja. This does not answer the question I have though. I understand how to use ActiveContent and can even use it with Multiselect. I am looking to have the options/suggest for these multiselect ActiveContents be different for each list item. The example you provided used a hard-coded array of options, not a dynamic one based on the data.

  • The point is that activeContent duplicates the same multiselect object (including the ID), so technically, you can reload the options depending on the parent row, but changing the data in the control will affect the available options in all rows (in other words, if 'tagC' does not exist in the options, it will not be rendered even if it is set as value in some row)

    The only proper solution here is to gather all possible values and provide them as options to the multiselect and use some filtering. rule to show only the needed options at a time
    https://webix.com/snippet/6cd680e9

  • edited January 2018

    Thank-you for the help, Nastja. The filtering solution you gave should help get us going in the right direction.

    I just tried this out on my application and it works great!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!