I have a label with id
lblResultI have the following code:
@(Html.TreeView(Model) .EmptyContent("root") .Children(m => m.Childs) .HtmlAttributes(new { id = "tree" }) .ChildrenHtmlAttributes(new { @class = "subItem" }) .ItemText(m => m.AssetNumber) .ItemTemplate( @ @*@item.AssetNumber*@ ) )Then, I have the following code on the view:
@using (Html.BeginForm("AssetTypeIndex", "ControlFiles", FormMethod.Get))
{
<div class="row">
<div class="col-lg-offset-2 col-lg-8 col-lg-offset-2">
<div class="form-inline">
<div class="input-group">
<span class="input-group-addon" id="basic-addon1">Search</span>
@Html.TextBox("SearchString", ViewBag.CurrentFilter as string, new { @class = "form-control" })
<span class="input-group-btn">
<button class="btn btn-default" type="submit" value="Search">View</button>
</span>
</div>
<div class="pull-right">
<a [email protected]("AssetTypeCreate", "ControlFiles") class="btn btn-default">Create New</a>
</div>
</div>
</div>
</div>
}
On script section:
$(function () { var selectedData; $('#jstree').jstree({ "core": { "multiple": true, "check_callback": true, 'themes': { "responsive": true, 'variant': 'small', 'stripes': false, 'dots': true } }, "types": { "default": { "icon": "glyphicon glyphicon-record" }, "root": { "icon": "glyphicon glyphicon-ok" } }, "plugins": ["dnd", "state", "types", "sort"] }).on('changed.jstree', function (e, data) { var i, j, r = []; for (i = 0, j = data.selected.length; i
If you see on the code above. There's a submit button which is trigger the search function on the controller.
My question is, Is it possible to run the 'Search Function' without clicking the button? I want to run the 'Search Function' when lblResult received the text from jsTree, it means when lblResult text is change.
Please advice.
Thank you.