or
var data = new kendo.data.DataSource({ transport: { read: function(options) { $.ajax( { url: "http://localhost/Projects/rpc", contentType: "application/json", dataType: "json", data: JSON.stringify({"method": "breq.getBreqs"}), type: 'POST', success: function (result) { //alert("success"); options.success(result) }, error: function (jqXHR, textStatus, errorThrown) { alert("Error: " + textStatus); options.error(jqXHR, textStatus, errorThrown) }, }); } }, serverPaging: true, pageSize: 10, schema: { data: "result" }, });
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>Text Field Autofocus</title> <link href="kendo.mobile.all.min.css" rel="stylesheet" type="text/css" /> <script src="jquery-1.7.2.min.js" type="text/javascript"></script> <script src="kendo.mobile.min.js" type="text/javascript"></script> </head> <body> <div id="one" data-role="view"> <div class="km-navbar" data-role="navbar"> Page 1 </div> <br /> <span>Click the button to be taken to the 2nd page</span> <br /> <br /> <a class="km-button" href="#two">Go To Page 2</a> </div> <div id="two" data-role="view" data-show="focusTextbox"> <!-- function call does not work here --> <div class="km-navbar" data-role="navbar"> <a class="km-button km-back" onclick="javascript:history.go(-1)" data-align="left">Back</a> <input id="input" type="search" data-align="left" placeholder="Search Box"/> </div> <br /> <span>The text field should be programatically focused on the view's show event.</span><br /> <br /> <button onclick="focusTextbox()">Manually Focus</button> <!-- calling from here works --> </div> </body> <script type="text/javascript"> var app = new kendo.mobile.Application($(document.body)); function focusTextbox() { $("#input").focus(); } </script></html>setTimeout(function () { $("#input").focus();}, 500);