Search Support
-
Martin LorenzJanuary 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 SupportJanuary 23, 2017 at 3:03 pm #3535Hi Martin,
There is no “addColumns” supported method for the Table control. The available methods are located in the JS Doc here: http://support.salientprocess.com/docs/enterprise/Table.html
Regards,
Stephen P.
Vignesh DhakshinamoorthyFebruary 14, 2017 at 5:37 pm #3708If 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:
http://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 dotable1.refresh();
since it’s a Service Data Table.SPARK SupportFebruary 17, 2017 at 2:30 pm #3759Hi 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.
-
|
You must be logged in to reply to this topic.