Selecting listgrid row from external event

Per topic title, any suggestions on how to select a row in a listgrid?

Example sceneraio: Clicking button A selects and highlights row 6 in listgrid B.

Thanks.
- Terence

Select Row of Listgrid

Hi tordona,

There is a possibility to highlights specific row of listgrid when you click a button.

The steps:
1. set the 'selectedIndex' attribute of listGrid
2. set the 'focusedRow' property of listGrid
3. FireEvent 'focus'

so below I give the snippet code

<b:listGrid id="listGrid">
...
</b:listGrid>


<button>focus row 1
<e:handler event="click" type="application/javascript">
        var listgrid = bb.document.getElementById("listgrid");
var selectedIndexes = listgrid.getAttribute("selectedIndexes");
listgrid.setAttribute("selectedIndexes", "1");
listgrid.setProperty("focusedRow", 1);
bb.command.fireEvent(listgrid, "focus", false, false);
</e:handler>
</button>

It will then select the row 1.

Hope this helps

:)

Thanks. Works good. Seems

Thanks. Works good. Seems when I tried to do this, I was not changing the focusedRow, I was only changing the selectedIndex.

Another question. If I have a sort applied on the listgrid, and my selectedRow jumps to another page (using BB pager on a datasource that is a localrecord), how can I:

1) determine the page it is on, then
2) jump to that page