Datatable with a column editor and suggest ui

I have a datatable with column text editors (each with their own suggest list, defined through the ‘columns’ property of the datatable). I need to be able to change a column’s ‘suggest’ list dynamically AFTER the datatable was rendered. I can change the suggest list by updating the datatable.config.columns collection, but that triggers a webix error when the users opens the suggest dropdown (‘node’ problem). Tried calling datatable.refresh() and datatable.refreshColumns(…) but neither of that resolves the problem. Can you give me a hint how to refresh a suggest list, without having to rebuild the entire datatable?

Try to redefine options through the data collection:

http://webix.com/snippet/aa4ac95a

hi Listopad, Thank you, nice solution and so simple again.

hi Listopad,

I see how this works in your snippet example, but on my local machine (either referencing webix.js or webix_debug.js, the column properties that I get from getColumnConfig() don’t include a ‘collection’ properties (undefined). Can you please tell me why?

Seems strange. I tried to reproduce this issue, but everything works fine on various Webix versions/browsers.

hi Listopad,

I am having kind of same problem. I have the below code

on:{
   onBeforeEditStart:function(id){
      var options = this.getColumnConfig(id.column).collection;
      options.clearAll();
      let upgrades= findUpgrades('sku');
      options.parse(upgrades);
   }
}

I selected value in the first row, when I tried to change the value in second row, its wiping out the value in first row because of clearAll method. Is there a way to clear dropdown values of that particular cell?

Thanks in advance

Hi,

\> getColumnConfig() don’t include a ‘collection’

The point of that issue is in the options definition. Constructor processes different notation in different ways:

This will result a full-featured collection:

{ 
	id:"title",
	options:[{id:1, value:"..."}, ... ]	// array of objects
}

And this - an object options:{ value1:"value1", value2:"value2"}:

{ 
	id:"title",
	options:[{"value1", "value2" ]	// array os strings
}

\> row is wiping out the value in the first row because of clearAll method

Both collection and options are defined for the entire column and redefinition will affect the data that depend on this options.

In such case, I can suggest you try richselect editor, which provides a possibility to filter the options in its popup:

http://webix.com/snippet/b11e53c5

Please check the related topic with more complex samples:

http://forum.webix.com/discussion/comment/9447/#Comment_9447

Thank you for quick response.