CA Service Management

Expand all | Collapse all

Keep table selection after fetch

  • 1.  Keep table selection after fetch

    Posted 06-05-2017 10:18 PM

    I need to know if there is any way to keep a table selection for multiple report/Plugin calls and after a fecthTableData. Users need to validate table input based on a text field. Table use a report with this text as an input and then select the correct row, but There is a need to do it several times While creating the catalog request.

     

    Unfortunately, after text field change, table is updated but selection is lost. 

     

    Is there another way to do what is described?

     

    Here some screenshots...

     

     

    Here is where selection is lost after AddUserId Field change...

     

    Thanks for your suggestions.

     

    Regards,

    JOHN



  • 2.  Re: Keep table selection after fetch

    Broadcom Employee
    Posted 06-06-2017 01:53 AM

    Good Morning John.

     

    An option could be to create 'hidden=true' and 'disabled=true' fields on the form.

    Which get populated with the content of the selected row.

    And then used to -repopulate the fields when needed.

     

    Thanks and kind regards, Louis van Amelsfort.



  • 3.  Re: Keep table selection after fetch

    Posted 06-06-2017 08:23 AM

    You can have a second table and on every selection on the first table you use ca_fdGetSelectedTableRows and then add it to the second table with ca_fdAddTableRow



  • 4.  Re: Keep table selection after fetch

    Posted 06-07-2017 10:47 AM

    Thanks pier-olivier.tremblay

     

    Do you know how I refer to the data in the original table to send them to the second table?

    Is there any format to access the value of a column?

     

    Regards,

    JOHN



  • 5.  Re: Keep table selection after fetch

    Posted 06-07-2017 03:13 PM

    Look in the form designer API.

     

    You will need a function that gathers the selected rows in the first table then write them to the second table.

     

    You should call this function just before refreshing the data when the user change the search criteria in your textbox

     

    So onChange of AddUserID, you should call a function that does :

     

    get selected rows of table 1

    add these rows to table 2

    fetch data for table 1 based on AddUserID

     

     

     

     

    DOC :

    ca_fdAddTableRow(formId, _id, values)
    Adds a row to the table component. The third argument contains the row data as a JavaScript object, e.g. {'userid':'spadmin','age':'31'}. Object attributes correspond to the _id the table columns and the value of the attributes correspond to the value of the cell in the row. In the case provided the table contains two columns with _ids userid and age. This call will add a row with cells spadmin and 31, ca_fdAddTableRow('myForm','myTable',{'userid':'spadmin','age':'31'}) The newly added row will be automatically selected.
    Example
    // here col1, col2 and col3 are _ids of the three columns in the table with _id = table
    ca_fdAddTableRow('form1','table',{'col1':'a','col2':2,'col3':_.user.id});

     

     

     

    ca_fdGetSelectedTableRows(formId, _id)
    Returns all selected table rows as JavaScript objects.
    Example
    var selectedRows = ca_fdGetSelectedTableRows('form1','table');
    var numSelectedRows = selectedRows.length;
    // get the value of the user column (column _id = user) in the first selected row
    var firstUser = selectedRows[0].user