Hello folks
I got this one nearly done. I can see that it is hitting my controller in the background but the refresh just keeps spinning :)
@model myHinkleyWebApp.Models.ItemInventory
<div id="table_data"><hr /><div class="row"><div class="col-12 padding-0"><h5>Check Product Availability</h5><div class="k-d-flex k-justify-content-left" style="padding-top: 54px;"><div class="k-w-100 text-left">
@{Html.RenderPartial("../Shared/EditorTemplates/Item_Search_Editor");}
</div><div class="k-w-200 text-left"><input id="btnSubmit" type="submit" style="margin-left: 25px;" value="Submit" class="btn btn-outline-primary" name="submit" /></div></div>
@(Html.Kendo().Grid<myHinkleyWebApp.Models.ItemInventory>()
.Name("ItemInventory")
.Columns(columns => {
columns.Bound(p => p.Item_no);
columns.Bound(p => p.Family);
columns.Bound(p => p.Status);
columns.Bound(p => p.DNPrice);
columns.Bound(p => p.MapPrice);
columns.Bound(p => p.QuantityAvailable);
columns.Bound(p => p.QuantityConfirmed);
columns.Bound(p => p.ConfirmedPromiseDate);
//columns.Bound(p => p.inventory_id).Title("").ClientTemplate("<a href='" + Url.Action("Delete", new { id = "#=inventory_id#", m_id = "#=customer_id#" }) + "'>Delete</a>");
//columns.Command(command => command.Destroy()).Width(150);
})
.ToolBar(tools => tools.Excel())
//.Editable(editable => editable.Mode(GridEditMode.InCell))
.Pageable()
.Navigatable()
.Sortable()
//.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(10)
.Batch(true)
.ServerOperation(false)
.Events(events => events.Error("error_handler"))
//.Model(model => { model.Id(p => p.inventory_id); model.Field(p => p.inventory_id).DefaultValue(Guid.Empty); model.Field(p => p.customer_id).DefaultValue(Guid.Empty); })
//.Create("Item_Create_Update", "HLI_Customer_Specific_Inventory", new { CusNo = Model.CusNo })
//.Read("SearchItems_ByNameOrFamily", "ItemInventory", new {search_phrase = ViewBag.SearchPhrase})
//.Update("Item_Create_Update", "HLI_Customer_Specific_Inventory", new { CusNo = Model.CusNo })
//.Destroy("Item_Destroy", "HLI_Customer_Specific_Inventory", new { CusNo = Model.CusNo })
)
)
</div><br /><br /></div></div><script>
function error_handler(e) {
if (e.errors) {
var message = "Errors:\n";
$.each(e.errors, function (key, value) {
if ('errors' in value) {
$.each(value.errors, function () {
message += this + "\n";
});
}
});
alert(message);
}
}
$("#btnSubmit").click(function () {
var ItemInventory = $("#ItemInventory").data("kendoGrid");
$filter = new Array();
var ITEM = $("#item_no").val();
$.ajax({
type: "POST",
url: "/ItemInventory/SearchItems_ByNameOrFamily",
data: { search_phrase: ITEM },
dataType: "json",
success: function (result) {
var ds = new kendo.data.HierarchicalDataSource({
data: result
});
ItemInventory.setDataSource(ds);
ItemInventory.read();
ItemInventory.refresh();
}
});
//ItemInventory.dataSource.read();
});
</script>
After I click the button the grid is just spinning here is a view of that:
So really the help I need is with this javascript here:
$("#btnSubmit").click(function () {
var ItemInventory = $("#ItemInventory").data("kendoGrid");
$filter = new Array();
var ITEM = $("#item_no").val();
$.ajax({
type: "POST",
url: "/ItemInventory/SearchItems_ByNameOrFamily",
data: { search_phrase: ITEM },
dataType: "json",
success: function (result) {
var ds = new kendo.data.HierarchicalDataSource({
data: result
});
ItemInventory.setDataSource(ds);
ItemInventory.read();
ItemInventory.refresh();
}
});
//ItemInventory.dataSource.read();
});
To summarize I have a auto complete text box where I am entering an item. Then i want to push the button and refresh my grid which will pass the
item number and search for it and bring it back down in the grid!
Any help would be greatly appreciated!
Anyways here is my front end code here