• Martin Lorenz
    January 11, 2017 at 12:53 pm #3470

    Hello,

    I would like to ask whether if is possible dynamically adding columns to SPARK Table control?

    SPARK Support
    January 23, 2017 at 3:03 pm #3535

    Hi Martin,

    There is no “addColumns” supported method for the Table control. The available methods are located in the JS Doc here: https://support.salientprocess.com/docs/enterprise/Table.html

    Regards,

    Stephen P.

    Vignesh Dhakshinamoorthy
    February 14, 2017 at 5:37 pm #3708

    If you are using a service data table, then you can achieve this using setColumns(), followed by refresh()

    You first define the number of columns, and how to format and display each one of them in a object and then reload the table.

    Refer this official link for an example:

    https://support.salientprocess.com/docs/enterprise/ServiceDataTable.html#setColumns

    Example (quoting from above link):
    var table1 = page.ui.get("Table1");
    var columnSpecs = [ {width: "20%", visibility: true, sortable: true, cssClass: "", dataElementName: "str1", type: "Text", label: "Str1"}, {width: "25%", visibility: true, sortable: true, cssClass: "", dataElementName: "int1", type: "Integer", label: "Int1"}];
    table1.setColumns(columnSpecs);
    table1.refresh();

    There is a small correction that I made here, which is in the last line. Instead of table1.executeService(); you have to do table1.refresh(); since it’s a Service Data Table.

    SPARK Support
    February 17, 2017 at 2:30 pm #3759

    Hi Martin and Vignesh,

    The Service Data Table control definitely has a lot of potential to be extended into more robust controls.  In fact, we do add custom methods to build the SDT into other controls that achieve this functionality.

    However, keep in mind that these would be custom applications, and unsupported use of the Out-of-the-box control.

    That being said, you may want to try the following “unsupported” code with SPARK 4.4.8 or higher:

     

    sdt = page.ui.get(“Service_Data_Table1”);

    cspecs = sdt.getColumns();

    cspec = cspecs[3];

    cspecs.push(cspec);

    sdt.setColumns(cspecs);

    sdt.refresh();

     

    Regards,

    Stephen P.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

Start typing and press Enter to search