Estoy construyendo una tabla con Tabulator5.2, necesito pasar algunos datos a cada fila como datos ocultos como DB_ID ..etc ejemplo:-
{'extrId' : 10 , 'connectionDbIndex' : 101 }Para obtener todos los datos al llamar a row.getData() u otro método.
Déjame compartir cómo construyo la mesa.
Estos son los encabezados de la tabla..
var tableHeaders = [ {formatter:"rowSelection", width:20 , titleFormatter:"rowSelection", hozAlign:"left", headerSort:false, cellClick:function(e, cell){cell.getRow().toggleSelect();}} , {title:'id", field:"ID" , hozAlign:"left" ,responsive:2 , headerFilter:'input', headerFilterLiveFilter:true ,headerSort:false } ]Esta es la tabla de datos: -
var i = 0 counter = 2000 while (i < counter){ var more = {'DB_ID' : 2012 } var row = {id:1+i, name:"Oli Bob"+i, progress:12, gender:"male"+i, rating:1, col:"red", dob:"19/02/1984", car:1 , site:'new' , ticket:12 , opened:false , cssClass:class2.randomId() , data : {'s' : 10}} class2.insert_row(row , more) i++ }& esta es la función responsable de agregar las filas.
insert_row(payload , more){ this.tableContent.push(payload) this.rowMoreData.push(more) for (let key in payload ){ var headerLabel = key if (! this.alreadyColumsAdded.includes(headerLabel)){ this.alreadyColumsAdded.push(headerLabel) var a = {title:headerLabel, field:headerLabel , hozAlign:"left" ,responsive:2 , headerFilter:'input', headerFilterLiveFilter:true ,headerSort:false } this.tableHeaders.push(a) } } }Una vez que todas las filas se agregaron al dict. Finalmente construye la mesa.
var table = new Tabulator(this.tableId, this.tableOptions);Entonces, ¿cómo es posible agregar algunos datos ocultos a cada fila?