1st Grid in a partial view which is rendering fine:
@(Html.Kendo().Grid<OpenInvoicesInfo>()
.Name("OpenInvoiceGrid")
.ColumnMenu(i => i.Columns(false))
.Columns(columns =>
{
columns.Bound(p => p.INVOICE).ClientTemplate("<input type='checkbox' value='#= INVOICE #' class='testclass' />").Width(4);
columns.Bound(i => i.INVOICE).Title("Invoice").Width(15);
2nd grid rendering fine intially with initial given invoices but not sure how to get selected checkbox invocies from first grid and updated 2nd grid
@(Html.Kendo().Grid<CustomerComments>()
.Name("CustomerCommentsGrid")
.ColumnMenu(i => i.Columns(false))
.Columns(columns =>
{
columns.Bound(i => i.Invoice).Title("Invoice").Width(15);
columns.Bound(i => i.Comment).Title("Comment").Width(40);
}).Pageable(pageable => pageable
.Refresh(true)
)
.Scrollable()
.Sortable()
.Filterable()
.DataSource(dataSource => dataSource
.Ajax().UseJniErrorHandler()
.PageSize(10)
.Read(read => read.Action("GetCustomerComments", "Maint"))
)
)
<script type="text/javascript">
function GetAllInvoicesComments() {
var result = [];
var items = $("#OpenInvoiceGrid").find(".testclass").filter(":checked");
items.each(function () {
result.push({
Value: $(this).val(),
Checked: true
});
});
$.ajax({
url: webManager.resolveUrl("~/maint/GetCustomerComments"),
//data:
method: "POST",
data: { invoices:result},
success: function () {
var grid = $('#CustomerCommentsGrid').data('kendoGrid');
grid.dataSource.read();
grid.refresh();
},
error: function () {
alert('an error occurred');
}
});
}
</script>
2nd Grid's Controller - I am able to invoke and able to pass selected invoices in parameter:
public ActionResult GetCustomerComments([DataSourceRequest] DataSourceRequest request, string invoices)
{
invoices = "'F300003634','F300003764'";//hard coding to see it first time
List<JNI.Enterprise.Contracts.CustomerComments> customer = InvoiceService.GetCustomerComments(invoices);
return Json(customer.ToDataSourceResult(request));
}
Problem is it is again getting called because of this .Read(read => read.Action("GetCustomerComments", "Maint")) and I don't want to call them 2nd time only call once when page is loaded initially.
Thank you.
Also wondering is it possible to update grid if it is in different partail view?
Right now just FYI 2nd partial view with 2nd grid (from 1st partial view) is not loading.
@(Html.Kendo().Grid<OpenInvoicesInfo>()
.Name("OpenInvoiceGrid")
.ColumnMenu(i => i.Columns(false))
.Columns(columns =>
{
columns.Bound(p => p.INVOICE).ClientTemplate("<input type='checkbox' value='#= INVOICE #' class='testclass' />").Width(4);
columns.Bound(i => i.INVOICE).Title("Invoice").Width(15);
2nd grid rendering fine intially with initial given invoices but not sure how to get selected checkbox invocies from first grid and updated 2nd grid
@(Html.Kendo().Grid<CustomerComments>()
.Name("CustomerCommentsGrid")
.ColumnMenu(i => i.Columns(false))
.Columns(columns =>
{
columns.Bound(i => i.Invoice).Title("Invoice").Width(15);
columns.Bound(i => i.Comment).Title("Comment").Width(40);
}).Pageable(pageable => pageable
.Refresh(true)
)
.Scrollable()
.Sortable()
.Filterable()
.DataSource(dataSource => dataSource
.Ajax().UseJniErrorHandler()
.PageSize(10)
.Read(read => read.Action("GetCustomerComments", "Maint"))
)
)
<script type="text/javascript">
function GetAllInvoicesComments() {
var result = [];
var items = $("#OpenInvoiceGrid").find(".testclass").filter(":checked");
items.each(function () {
result.push({
Value: $(this).val(),
Checked: true
});
});
$.ajax({
url: webManager.resolveUrl("~/maint/GetCustomerComments"),
//data:
method: "POST",
data: { invoices:result},
success: function () {
var grid = $('#CustomerCommentsGrid').data('kendoGrid');
grid.dataSource.read();
grid.refresh();
},
error: function () {
alert('an error occurred');
}
});
}
</script>
2nd Grid's Controller - I am able to invoke and able to pass selected invoices in parameter:
public ActionResult GetCustomerComments([DataSourceRequest] DataSourceRequest request, string invoices)
{
invoices = "'F300003634','F300003764'";//hard coding to see it first time
List<JNI.Enterprise.Contracts.CustomerComments> customer = InvoiceService.GetCustomerComments(invoices);
return Json(customer.ToDataSourceResult(request));
}
Problem is it is again getting called because of this .Read(read => read.Action("GetCustomerComments", "Maint")) and I don't want to call them 2nd time only call once when page is loaded initially.
Thank you.
Also wondering is it possible to update grid if it is in different partail view?
Right now just FYI 2nd partial view with 2nd grid (from 1st partial view) is not loading.