This is a migrated thread and some comments may be shown as answers.

select a row based on the dropdownlist value or text

1 Answer 63 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 09 Dec 2013, 11:07 AM
Hello again,
how can i select a grid row,based on the value or the text of a dropdownlist?

first of all,i looked over the demo api on kendo site, and the code
@{
    ViewBag.Title = "GridApi";
}

<h2>GridApi</h2>
<div id="grid"></div>
<script>
    $("#grid").kendoGrid({
        columns: [
    { field: "name" },
    { field: "age" }
  ],
        dataSource: [
    { name: "Jane Doe", age: 30 },
    { name: "John Doe", age: 33 },
  ]
    });
    var grid = $("#grid").data("kendoGrid");
    var row = grid.tbody.find("tr:eq(0)"); OR variant 2: var rowIndex=1;row = grid.tbody.find(">tr:not(.k-grouping-row)").eq(rowIndex);
    var data = grid.dataItem(row);
    grid.select(row);
    console.log(data.name); // displays "Jane Doe"
</script>

i attached a picture with the error in firebug.

1 Answer, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 09 Dec 2013, 11:46 AM
Hi Daniel,


The current sample code is missing the selectable option of the Grid, which is present in the example from the API docs. Regarding the current scenario, could you please elaborate a bit more and specify what exactly is the desired behavior? As a general advice, I would suggest you to bind to the select or change event of the DropDown and use the information in the event handler to select the appropriate row in the Grid.

Please let me know if this was the information that you were looking for.

Regards,
Dimiter Madjarov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Daniel
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Share this question
or