Table filter with onRowClick

I am trying to get a 2nd table to filter based on onrowclick action in the first table.

  "actions_onRowClick": [
      "action": "function",
      "function": " = action.options.params.row.loadNum",
      "options": {}
  1. onRowClick sets an ID in the model
  2. Table 2 uses filter_calc option

Is this the right approach? Need a little guidance.

You may want to take a look at the Master Detail example here. You’re on the right track, but instead of putting a filter_calc on the 2nd table, I would suggest using the _.filter() method of lodash to populate a new array of data into your model and base the 2nd table off of that filtered array.

Almost there…the filter part isn’t just right.

“actions_onRowClick”: [{
“action”: “function”,
“function”: “formSchema.model.activeLoadNum = action.options.params.row.loadNum\n\n”,
“options”: {}
}, {
“action”: “function”,
“function”: “formSchema.model.activeLoad = _.filter(model.orders.loadNum, ‘model.activeLoadNum’)\n\n”,
“options”: {}


@eluce Am I even Close?

formSchema.model.activeLoad = _.filter(model.orders, { ‘loadNum’ : model.activeLoadNum })

One thing to think about is amount of data, if the left side is a ‘find’ for the right, then you may want to call FMS and return data for the right side. That is what I would do.

If you want to have all the data in the page then yes you can filter it with lodash

it would look something like
model.flteredArray = _.filter(model.sourceArray, {'status' : 'active' } )

where this wil show all active status rows.

1 Like