Devextreme JS DXGrid如何在代码后面调用cellTemplate

时间:2016-04-14 10:36:50

标签: asp.net devextreme

我正在尝试在代码中调用cellTemplate函数,但我无法调用。有没有办法从代码后面调用这个函数?我尝试过,你可以在下面看到,但行显示“ShowButton”

private static void parse(String str) 
{
    ANTLRInputStream input = new ANTLRInputStream(str);
    AmbLexer lexer = new AmbLexer(input); 
    CommonTokenStream tokens = new CommonTokenStream(lexer); 
    AmbParser parser = new AmbParser(tokens);
    ParseTree tree = parser.expr();
    System.err.println(tree.toStringTree(parser));
}

JAVASCRIPT

ListDxColum.Add(new DxColumns(){
                        dataField = "cor_ref",
                        caption = "",
                        allowFiltering = false,
                        cellTemplate = "ShowButton"

                    });

1 个答案:

答案 0 :(得分:0)

您可以使用此代码:

var orders = rec.documentList;
       var grid = $("#gridContainer").dxDataGrid({
            dataSource: {
                store: {
                    type: "array",
                    key: "ID",
                    data: orders
                }
            },
            paging: {
                pageSize: 8
            },

            showRowLines: true,
            showBorders: true,
            selection: {
                mode: "single"
            },
            filterRow: { visible: true },
            //searchPanel: {
            //    visible: true
            //},
            columns: rec.DxColumHeader,
            paging: { pageSize: 6 },
            wordWrapEnabled: true,
            filterRow: { visible: false },
            columnAutoWidth: false,
            cellTemplate: function (container, options) {
                console.log(options.data["cor_ref"]);
            }
        }).dxDataGrid('instance');