Hi,
Please see my attached screenshot. Each time a user click on the search button, my listview should repopulate with the new results. I have tried the dataSource.read() / refresh() methods in the button click but it’s not working. Any one from telerik, please go through my code and give me a working solution.
CODE
<head>
<title></title>
<script src="Mobile_JS/jquery.min.js" type="text/javascript"></script>
<script src="Mobile_JS/kendo.mobile.min.js" type="text/javascript"></script>
<link href="Mobile_CSS/kendo.mobile.all.min.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="vw_AddTradeRequest" data-role="view" data-title="New Trade Request" data-init="intSecModal">
<header data-role="header">
<div data-role="navbar">
<a data-align="left" data-role="backbutton">Back</a> <span data-role="view-title">
</span>
</div>
</header>
<ul id="lvw_formElement" data-role="listview" data-style="inset">
<li>Security
<ul style="list-style-type:none;"><li><input type="text" style="right:2.2em;"/>
<a data-role="detailbutton" data-rel="modalview" data-icon="more" href="#mvw_SearchSec"></a></li></ul>
</li>
</ul>
<div data-role="modalview" id="mvw_SearchSec" style="width: 90%;">
<header data-role="header">
<div data-role="navbar">
<input id="txt_SearchSecurity"
type="text" style="border: 1px solid Gray;margin-right:0.1em;" data-align="left" value="amgn"/><a data-role="button" id="btn_searchSecurity" data-align="left">Search</a>
<a data-role="button" id="btn_clearSearchSec" data-align="left">Clear</a>
<a data-role="button" data-align="right" data-click="closeSecSearchModalView">Close</a>
</div>
</header>
<ul id="lvw_Search" data-role="listview">
<li>
</li>
</ul>
<ul id="lvw_Security" />
</div>
</div>
<script id="kt_SecurityListTemplate" type="text/x-kendo-template">
<div>
#= SYMBOL #
</div>
</script>
<script id="kt_SecurityHeadTemplate" type="text/x-kendo-template">
<h3> HI</h3>
</script>
<script>
function intSecModal() {
var secData = new kendo.data.DataSource({
transport: {
read: {
url: "mypage.aspx?security=&sm=0&ft=" + $("#txt_SearchSecurity").val(), // the remove service url
dataType: "json"
}
}
});
$("#lvw_Security").kendoMobileListView({
dataSource: secData,
template: $("#kt_SecurityListTemplate").text(),
click: function (e) {
console.log(e.dataItem.SYMBOL);
}
});
$("#btn_searchSecurity").click(function () {
var lvwObjSecurity = $("#lvw_Security").data("kendoMobileListView");
lvwObjSecurity.dataSource.read();
});
$("#btn_clearSearchSec").click(function () { $("#txt_SearchSecurity").val("");});
}
function closeSecSearchModalView() {
$("#mvw_SearchSec").kendoMobileModalView("close");
}
</script>
</body>
Thanks and Regards,
Sibin