<a id="window"></a> @(Html.Kendo().Grid<Models.AssetLocationViewModel>() .Name("GridLocation") .Columns(columns => { //columns.Bound(p => p.UserId).Width(125); columns.Bound(p => p.CampanyCode).Width(125); columns.Bound(p => p.location1code).Width(165).Filterable(false); columns.Bound(p => p.location2code).Width(150).Filterable(false); columns.Bound(p => p.locationCode).Width(125); columns.Bound(p => p.Name).Width(150); columns.Bound(p => p.ShortName).Width(150); columns.Bound(p => p.CreatedBy).Width(150); columns.Bound(p => p.ModifyBy).Width(150); //columns.Bound(p => p.Designation).Width(150); columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200); }) .ToolBar(toolbar => toolbar.Create()) .Editable(editable => editable.Mode(GridEditMode.InCell)) .Pageable() .Sortable() .Scrollable() .Selectable() .Filterable(filterable => filterable .Extra(false) .Operators(operators => operators .ForString(str => str.Clear() .StartsWith("Starts with") .IsEqualTo("Is equal to") .IsNotEqualTo("Is not equal to") ))) .HtmlAttributes(new { style = "height:430px;" }) .DataSource(dataSource => dataSource .Ajax() .PageSize(20) //.Events(events => events.Error("error_handler")) .Model(model => model.Id(p => p.locationCode)) .Create(update => update.Action("AssetLocEditingPopup_Create", "Location")) .Read(read => read.Action("AssetLocationEditingPopup_Read", "Location")) .Update(update => update.Action("AssetLocEditingPopup_Update", "Location")) .Destroy(update => update.Action("AssetLocEditingPopup_Destroy", "Location")) ) ) <script type="text/javascript"> $(document).ready(function () { $("#GridLocation").on("dblclick", " tbody > tr > td", function () { //model.location2code = 100; //var grid = $("#GridLocation").data("kendoGrid"); //var data = grid.datasource.at(0); ////data.set("location1code", l1locode); //alert(data.location1code); //var gridDataArray = $('#GridLocation').data('kendoGrid')._data; //var columnDataVector = []; //var columnName = 'location1code'; ////for (var index = 0; index < gridDataArray.length; index++) { //// columnDataVector[index] = gridDataArray[index][columnName]; ////}; ////alert(columnDataVector[0]); //gridDataArray[0].text("location1code", "frfrf"); //$("#locapopupWindow").data('kendoWindow').open(); $("#window").load("@Url.Action("PopupWindow", "Location")"); //$(this).load("/Shared/_assetLocationPopup"); $('#GridLocation').data('kendoGrid').refresh() //firstItem.dirty = true; // set it as dirty //$('#GridLocation').data().kendoGrid.dataSource.sync(); }); }); </script>
@{Html.Kendo().Window() .Name("locapopupWindow") .Title("Select Location") .Draggable() .Width(500) .Height(300) .Actions(actions => actions .Custom("custom") .Minimize() .Maximize() .Close() ) .Content(@<text> @{Html.Kendo().Grid<IBATechnologies.IBA.Web.Models.AssetLocationViewModel>() .Name("locationpopupGrid") .Columns(columns => { columns.Bound(p => p.CampanyCode).Width(125).Visible(false); columns.Bound(p => p.location1code).Width(165).Visible(false); columns.Bound(p => p.location2code).Width(150).Visible(false); columns.Bound(p => p.Name).Width(150); columns.Bound(p => p.ShortName).Width(150); columns.Bound(p => p.CreatedBy).Width(150).Visible(false); columns.Bound(p => p.ModifyBy).Width(150).Visible(false); }) .Pageable() .Sortable() .Scrollable() .Selectable() .Filterable(filterable => filterable .Extra(false) .Operators(operators => operators .ForString(str => str.Clear() .StartsWith("Starts with") .IsEqualTo("Is equal to") .IsNotEqualTo("Is not equal to") ))) .HtmlAttributes(new { style = "height:250px;" }) .DataSource(dataSource => dataSource .Ajax() .PageSize(10) //.Events(events => events.Error("error_handler")) .Model(model => model.Id(p => p.location1code)) .Create(update => update.Action("Level2LocEditingPopup_Create", "Asset")) .Read(read => read.Action("Level2LocationEditingPopup_Read", "Location")) ) .Render(); } </text> ) .Render(); } <script> $(document).ready(function () { $("#locationpopupGrid").data("kendoGrid").bind("change", onLocationRowSelected); $("#locapopupWindow").data("kendoWindow").bind("close", onWindowClose); function onLocationRowSelected() { var grid = $("#locationpopupGrid").data("kendoGrid"); var selectedItem = grid.dataItem(grid.select()); orisfunction(selectedItem.location1code, selectedItem.location2code); $("#locapopupWindow").data("kendoWindow").close(); $("#locapopupWindow").data("kendoWindow").destroy(); } function orisfunction(l1locode, l2locode) { var grid = $("#GridLocation").data("kendoGrid"); var data = grid.dataSource.data()[0]; data.set("location1code", l1locode); data.set("location2code", l2locode); } function onWindowClose() { $("#locapopupWindow").data("kendoWindow").destroy(); } }); </script><<code></code>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)