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

Fail to set Kendo UI Widget selection/value in document.ready

4 Answers 214 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 08 Dec 2011, 09:06 AM
If I use below way to set Grid selection:
$(document).ready(function () {
}
$(document).ready(function () {
  $("#grid").kendoGrid(...);
  var grid = $("#grid").data("kendoGrid");
  //alert(1);
  var selection = grid.tbody.find(">tr").eq(1);
  grid.select(selection);
}

row selection will not succeed, if uncomment "alert()", row selection is working.
So I only can use below way to implement row selection in document.ready without "alert":
$(document).ready(function () {
  var grid = $("#grid").kendoGrid(...
    dataBound: function() {
        var selection = grid.tbody.find(">tr").eq(1);
        grid.select(selection);
    }
  ).data("kendoGrid");;
}


But for DropDownList, it is not so lucky.
DropDownList hasn't dataBound event, if I need to set its value during loading as below:
$(document).ready(function () {
  $("#DDL").kendoDropDownList(...);
  //alert(1)
  DDL.value(1);
}
It fails.
Could you figure out a way to implement setting DDL's value in loading?

btw: all these UI Widget are in Kendo Tab.

4 Answers, 1 is accepted

Sort by
0
John
Top achievements
Rank 1
answered on 15 Dec 2011, 07:53 AM
nobody knows?
0
Todd
Top achievements
Rank 1
answered on 29 Dec 2011, 01:44 AM
I haven't figured out how to set the value of the drop down list after the data has loaded either. I'm trying to set the default value after the data has loaded and I can't figure out how to do that.
0
Petyo
Telerik team
answered on 29 Dec 2011, 09:52 AM
Hi,

A databound event would help here, indeed. We will consider it for further implementation. Meanwhile, you can set the value of the HTML input element itself. The DropDownList widget will pick it after databinding.

<input id="dropdownlist" value="2" />

All the best,
Petyo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Todd
Top achievements
Rank 1
answered on 29 Dec 2011, 05:21 PM
Thanks, I'll give this a try.
Tags
General Discussions
Asked by
John
Top achievements
Rank 1
Answers by
John
Top achievements
Rank 1
Todd
Top achievements
Rank 1
Petyo
Telerik team
Share this question
or