richselect in datatale big problem

Hello. please, i need help to solve this problem. I inserted in a column of a datatable a richselect as you can see from the code that I posted below. I want to relate each cell of the “field name” column to the “associate tag” column, where the richselect is located, in order to save the values of the two IDs in a database table in the related fields: id_tag and id_field.
Thank you so much

var field = {
	id:"tabField",
	view:"datatable", 
	select:"row", 
	navigation:true, 
	editable:true,
	scroll:"xy",
	autoConfig:true,	
	columns:[
			{id:"id", header:"#", width:50},
			{id:"id_progetto", editor:"text", header:"progetto", sort:"string", fillspace: 1},
			{id:"id_field", editor:"text", header:"id Campo", sort:"string", fillspace: 1},
			{id:"nome_field", editor:"text", header:"Nome Campo", sort:"string", fillspace: 1},
			
			{id:"id_tag", editor:"richselect", header:"Associa TAG", vertical: true, options:"data/data_tag.php?idprogetto=[here parameter of id_progetto]",	fillspace: 1},
			{id:"edit", header:"&nbsp;", width:35, template:"<span  style=' cursor:pointer;' class='webix_icon fa-pencil'></span>"},
			{id:"delete", header:"&nbsp;", width:35, template:"<span  style='cursor:pointer;' class='webix_icon fa-trash-o'></span>"}
			 ],

			save: "connector->data/data_save_field_tag.php",
			url: "data/data_field_tag.php",

VALUE FROM data/data_tag.php INSERT IN richselect

[{"id_tag":"15","value":"descrizione"},{"id_tag":"16","value":"foto"},{"id_tag":"17","value":"potenza"},{"id_tag":"18","value":"Root"},{"id_tag":"19","value":"titolo"},{"id_tag":"20","value":"valore1"},{"id_tag":"21","value":"valore2"},{"id_tag":"22","value":"valore3"},{"id_tag":"23","value":"valore4"},{"id_tag":"24","value":"valore5"},{"id_tag":"25","value":"valore6"},{"id_tag":"26","value":"valore7"},{"id_tag":"27","value":"valore8"},{"id_tag":"28","value":"descrizione"},{"id_tag":"29","value":"foto"},{"id_tag":"30","value":"potenza"},{"id_tag":"31","value":"Root"},{"id_tag":"32","value":"titolo"},{"id_tag":"33","value":"valore1"},{"id_tag":"34","value":"valore2"},{"id_tag":"35","value":"valore3"},{"id_tag":"36","value":"valore4"},{"id_tag":"37","value":"valore5"},{"id_tag":"38","value":"valore6"},{"id_tag":"39","value":"valore7"},{"id_tag":"40","value":"valore8"}]

VALUE FROM data/data_field_tag.php INSERT IN datatable

[{"id":"1","id_progetto":"1","id_tag":"","nome_field":"id","id_field":"1"},{"id":"2","id_progetto":"1","id_tag":"","nome_field":"id_prodotto","id_field":"2"},{"id":"3","id_progetto":"1","id_tag":"","nome_field":"Nome","id_field":"3"},{"id":"4","id_progetto":"1","id_tag":"","nome_field":"id_tabella","id_field":"4"},{"id":"5","id_progetto":"1","id_tag":"","nome_field":"Specifica_1","id_field":"5"},{"id":"6","id_progetto":"1","id_tag":"","nome_field":"IP","id_field":"6"},{"id":"7","id_progetto":"1","id_tag":"","nome_field":"Classe","id_field":"7"},{"id":"8","id_progetto":"1","id_tag":"","nome_field":"Montaggio","id_field":"8"},{"id":"9","id_progetto":"1","id_tag":"","nome_field":"Cavo","id_field":"9"},{"id":"10","id_progetto":"1","id_tag":"","nome_field":"Collegamento","id_field":"10"},{"id":"11","id_progetto":"1","id_tag":"","nome_field":"Carrabile","id_field":"11"},{"id":"12","id_progetto":"1","id_tag":"","nome_field":"Peso","id_field":"12"},

CREATE TABLE `rel_tag_field` (
  `id` int(16) NOT NULL,
  `id_progetto` int(16) NOT NULL DEFAULT '1',
  `id_tag` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  `id_field` int(16) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

this is an example
https://snippet.webix.com/1c382041
I want to save the values in the database with a script in php

Hello @lucianotrinca,

I want to relate each cell of the “field name” column to the “associate tag” column, where the richselect is located, in order to save the values of the two IDs in a database table in the related fields: id_tag and id_field.

If I am understanding you correctly, the described functionality could look something like this: https://snippet.webix.com/dhrladmw. Basically, you will need to provide a set of options for your richselect editor in a key-value format (id/value). Upon selecting a certain value your id from the original set of options will be assigned to the id_tag field (the field this editor is set in).

thank you very much!! Dzmitry
I take this opportunity to ask you for more information.
when I create the select “Associate TAG”, however, I have to filter the fields according to the category they belong to. There can be multiple categories and the ID of each category groups some tags. For this reason I had inserted … editor: “richselect”, header: “Associate TAG”, vertical: true, options: “data / data_tag.php? Idprogetto = [here parameter of id_progetto]”. in fact I was wrong to insert the tag table with only the select values. there is a column that corresponds to the project id: [{“project_id”: 1, id_tag “:” 15 “,” value “:” description "}, …
thank you

Hi Dzmitry. how is the situation compared to coronavirus in your country? do you keep working? how are you? Here in Italy the situation is very serious but we will get out of it. I offer you my most sincere wishes for you and all your loved ones. good luck. :wink: Luciano

Hello @lucianotrinca, my apologies for the late response,

however, I have to filter the fields according to the category they belong to.

I am sorry, but I don’t think I quite understand the use case fully. Basically, you have a set of categories and each category has some tags attached to them. In the “Associa TAG” column you want to display the tags that are attached to a particular category. I.e. something that would look like this - https://snippet.webix.com/s6eryb7r? Please correct me if I’m wrong.

Hi Dzmitry. how is the situation compared to coronavirus in your country? do you keep working? how are you?

Thank you for asking, most of the company staff has been working remotely for the past few weeks, but we are still fully operational. The situation here is not nearly as serious as it is in Italy (yet), but the virus is spreading pretty fast. Thank you for the good wishes, and I hope you are safe as well in these times.

Hello
I would like to change option of this row of a datatable dynamically
{id: “select”, editor: “richselect”, header: “select”, width: 100, vertical: true, options: options} ,.
using a function that retrieves values from a php file and id from another field.
function (id) {
var values = $$ (‘mainView’). getValues (). id;
options = “data / data_tag.php? idprogetto =” + values; }
Thank you very much

Hi @lucianotrinca

Options that were defined as

{ 
  id: "select", editor: "richselect", 
  header: "select", width: 100, vertical: true, 
  options: options
} 

are stored after init as a DataCollection in column config (you can read the full description here ). So basically, you are able to do the following:

const data = datatable.getColumnConfig( columnId ).collection;
data.clearAll();
data.load( URL );

Snippet: Code Snippet

Still, please note that this collection is used for several purposes:

  • rendering editor options,
  • rendering options in the filter,
  • rendering data in templates;

If some data in the table has no matching value in the collection, the default template will display an empty string: Code Snippet