Using angular 1.x and jqx-grid, I have two separate tables on the same page (same scope).
The tables have a one-to-one relationship with one another. A Commodity
table and a CommodityDetails
table. The Commodity
table has a CommodityDetailsId
column corresponding to the Id on the CommodityDetails
table.
I'd like to be able to click the CommodityDetailsId
in the Commodity
table and on-click, I'd like the CommodityDetails
table's corresponding row to be scrolled to and highlighted.
In a particular example I came across, the jqx api provides the grid with a selectRow(int)
function that allows you to select the particular row on a grid. Now this works across differing tables, however I have yet to come across a way to select a row based on a condition. I would need something along the lines of selectRowBasedOn(x => x.CommodityDetailsId === commodityDetailsGrid.Id)
or something along those lines.
Is there a way to select/highlight a row in jqx-grids based on a condition of the grid?
Saw this post randomly. I happened to work on something similar recently. I modified my own code as an example. Not sure if it's suitable for your use case scenario, but hope it helps.
You need a
on rowclick listener
for the grid you first click. Then, you get the Id from the row you selected. After that, use a for loop to find the corresponding row in another grid. Finally, useselectrow
to select the row.Example: https://jsfiddle.net/gvy2s81w/ (You need to modify it to fit your case!)
html code:
JavaScript + jQuery code: