본문 바로가기

Frontend

Tabulator - Dynamic Column Values

반응형

Let's see how we can diaplay field values of Tabulator dynamically on the JSP with data fetched  from a DB. The way it is done is to use the Mutators module to manipulate the orginal data in a column of the table by calling a function as value for the Mutator

Implementaiont

Add the Mutators module and function as its value. The first parameter for the function represents the original data in the field while the second is the additional data object that we want pass on. In the example below I used a ternary expression to display between the original and new value depending on whether the original value is null or not

{title: "title", field: "val1", mutator: function (value, val2) {return (value == null) ? val2.val2 : value}}

So far we have seen how we can change the value of a column in the Tabulator table dynamically using the Mutator


References

Mutators & Accessors | Tabulator

 

Tabulator - Mutators & Accessors

Manipulate data as it enters or leaves a table

www.tabulator.info

 

728x90
반응형