I have a search results table from which I want to copy a row on selection to another table.
Ex: I have a “person” table with two columns, person_id and person_name. User can add a row in person table using ‘add person’ button. But instead of adding a blank row to the table, I want to open a modal dialog with search panel and search results table, on which a row can be selected and then added to “person” table.
In search results table, I have an “add” button in every row, and I used following code in on-click event:
var rowId = $(this).up('tr').id;
var rowModel = CAF.model(rowId);
var tableId = $(this).up('table').id;
var tableModel = CAF.model(tableId);
var personTableModel = CAF.model('#{caf:cid("personTable")}');
personTableModel .add(0, rowModel);
This code adds a blank row instead of values from search table’s selected row.
Further, is there any way to select columns that I can copy from selected row to another table. Say, if search results table contains person_id, first_name, last_name, ssn, then I want to copy ony person_id and first_name to “person” table.