Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
80
get_behaviors not available on client-side
posted

I have a WebHierarchicalDataGrid with the selection behavior enabled. It's set to select the row. In the html definition, the behaviors tag looks like this:

<Behaviors>
    <ig:Selection CellClickAction="Row" RowSelectType="Single"
    SelectedCellCssClass="RowHighlight">
        <SelectionClientEvents RowSelectionChanged="whdg_RowSelectionChanged" />
    </ig:Selection>
</Behaviors>

I'm trying to access the selected row from javascript when a button is clicked. The code for that function is:

var grid = $find("<%=myGrid.ClientID%>");

var selectedRows = grid.get_behaviors().get_selection().get_selectedRows();

However the code fails. get_behaviors() does not appear to be a method on the grid object. Am I missing something here? Everything I search for just says to use grid.get_behaviors(), but I can't make it work.

The selection behavior is working at run-time and my RowSelectionChanged event is firing and working correctly. I'm using NetAdvantage 2012.1 CLR 4x.

Any help is appreciated.

Parents
No Data
Reply
  • 80
    Verified Answer
    Offline posted

    I believe I found the answer. It looks like for Hierarchical grids, you must call get_gridView().

    So the solution is: var selectedRows = grid.get_gridView().get_behaviors().get_selection().get_selectedRows();

Children