在Tabulator 3.5中存储具有持久布局的headerFilter

时间:2018-10-08 15:32:38

标签: filter object-persistence tabulator

我尝试在导航过程中将过滤器字段存储到JSON对象中,并在tabulator.js中得到此Javascript问题:

选项错误-制表符不允许在初始化后设置选项,除非为此目的定义了功能

(java类)

    JsonObject configuracion = new JsonObject();
    configuracion.addProperty("height", "92%");
    configuracion.addProperty("tooltips", true);
    configuracion.addProperty("tooltipsHeader", true);


    configuracion.addProperty("persistentLayout", true); 
    configuracion.addProperty("layout","fitDataFill"); 
    configuracion.addProperty("persistenceMode", true); 
    configuracion.addProperty("persistenceID", myBandeja.getStrBandejaLogicaCaption().substring(0,4)); 
    configuracion.addProperty("persistentFilter", true);
    configuracion.addProperty("movableColumns", true);
    configuracion.addProperty("selectable", true);
    configuracion.addProperty("virtualDomBuffer",500);


    JsonObject fila = new JsonObject();
    JsonArray datasets = new JsonArray();
    for (Entry<Integer, String> entry : myTitleRow.entrySet()) {
                fila = new JsonObject();
                fila.addProperty("title", entry.getValue());
                fila.addProperty("field", entry.getValue());
                fila.addProperty("sorter", "string");
                fila.addProperty("headerFilter", "input");
                fila.addProperty("headerFilterPlaceholder", "Filtrar...");
                fila.addProperty("cellClick", "cellClickBandeja(e, cell);");

                datasets.add(fila);
        }
    configuracion.add("columns", datasets);

某些属性排序有误?

谢谢。

1 个答案:

答案 0 :(得分:1)

收到该消息时,它是以下两种情况之一。

您正在尝试使用jQuery的 选项 函数创建制表器后,更改制表器不允许的选项。

或者因为您试图在已经是Tabulator的元素上重新声明表。如果是这种情况,则需要在表上调用 destroy 函数,然后再次创建它:

$("#example-table").tabulator("destroy");