This is a migrated thread and some comments may be shown as answers.

Four grids on Page

1 Answer 22 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gerry Connolly
Top achievements
Rank 1
Gerry Connolly asked on 09 Jun 2014, 03:52 PM
Hi everyone.
I have question
I created four grids on one page.

@(Html.Kendo().Grid<SupplierModel>()
      .Name("SubmittedGrid")
      .Columns(columns =>
          {
              columns.Bound(p => p.SupplierId).Title("ID");
              columns.Bound(p => p.ClientName);
              columns.Bound(p => p.Name).Title("Supplier");
              columns.Bound(p => p.SupplierGroupName).Title("Group");
              columns.Bound(p => p.ShortName);
              columns.Bound(p => p.Address1);
              columns.Bound(p => p.Address2);
              columns.Bound(p => p.RejectReason).Title("Reason");
              columns.Bound(p => p.SupplierId).Title(" ").Template(@<text>
                                                                        @Html.ActionLink("Review", "Edit", new { supplierId = @item.SupplierId.Value })
                                                                    </text>);
              //columns.Command(command => command.Edit()).Title(" ");
          })
      .Pageable()
      .Sortable()
      .Selectable()
      .DataSource(dataSource => dataSource.Server()
                                           .PageSize(GlobalVariables.DefaultPageSize)
                                           .Model(model =>
                                               {
                                                   model.Id(p => p.SupplierId);
                                               })
                                           .Read(read => read.Action("GetNewSuppliers", "Requestor"))
                                           .Update(update => update.Action("Edit", "Requestor"))
      ).Resizable(resize => resize.Columns(true))
      )
 
@(Html.Kendo().Grid<SupplierModel>()
      .Name("SubmittedGrid")
      .Columns(columns =>
          {
              columns.Bound(p => p.SupplierId).Title("ID");
              columns.Bound(p => p.ClientName);
              columns.Bound(p => p.Name).Title("Supplier");
              columns.Bound(p => p.SupplierGroupName).Title("Group");
              columns.Bound(p => p.ShortName);
              columns.Bound(p => p.Address1);
              columns.Bound(p => p.Address2);
              columns.Bound(p => p.RejectReason).Title("Reason");
              columns.Bound(p => p.SupplierId).Title(" ").Template(@<text>
                                                                        @Html.ActionLink("Review", "Edit", new { supplierId = @item.SupplierId.Value })
                                                                    </text>);
              //columns.Command(command => command.Edit()).Title(" ");
          })
      .Pageable()
      .Sortable()
      .Selectable()
      .DataSource(dataSource => dataSource.Server()
                                          .PageSize(GlobalVariables.DefaultPageSize)
                                          .Model(model =>
                                              {
                                                  model.Id(p => p.SupplierId);
                                              })
                                          .Read(read => read.Action("GetSubmittedSuppliers", "Requestor"))
                                          .Update(update => update.Action("Edit", "Requestor"))
      ).Resizable(resize => resize.Columns(true))
      )
 
@(Html.Kendo().Grid<SupplierModel>()
      .Name("ApprovedGrid")
      .Columns(columns =>
          {
              columns.Bound(p => p.SupplierId).Title("ID");
              columns.Bound(p => p.ClientName);
              columns.Bound(p => p.Name).Title("Supplier");
              columns.Bound(p => p.SupplierGroupName).Title("Group");
              columns.Bound(p => p.ShortName);
              columns.Bound(p => p.Address1);
              columns.Bound(p => p.Address2);
              columns.Bound(p => p.RejectReason).Title("Reason");                  
              //columns.Command(command => command.Edit()).Title(" ");
          })
      .ToolBar(toolBar =>
          {
              toolBar.Template(@<text>
                                    <div class="toolbar-to-right">
                                        <label>Supplier:</label>
                                        <span class="k-textbox">
                                            <input id="supplierFilter" />
                                            <a href="#" class="k-icon k-i-search"> </a>
                                        </span>
                                    </div>
                                </text>);
 
          })
      .Pageable()
      .Sortable()
      .Filterable()
      .Selectable()
      .DataSource(dataSource => dataSource.Server()
                                          .PageSize(GlobalVariables.DefaultPageSize)
                                          .Model(model =>
                                              {
                                                  model.Id(p => p.SupplierId);
                                              })
                                          .Read(read => read.Action("GetApprovedSuppliers", "Requestor"))
                                          .Update(update => update.Action("Edit", "Requestor"))
      ).Resizable(resize => resize.Columns(true))
      )
 
@(Html.Kendo().Grid<SupplierModel>()
      .Name("RejectedGrid")
      .Columns(columns =>
          {
              columns.Bound(p => p.SupplierId).Title("ID");
              columns.Bound(p => p.ClientName);
              columns.Bound(p => p.Name).Title("Supplier");
              columns.Bound(p => p.SupplierGroupName).Title("Group");
              columns.Bound(p => p.ShortName);
              columns.Bound(p => p.Address1);
              columns.Bound(p => p.Address2);
              columns.Bound(p => p.RejectReason).Title("Reason");
              columns.Bound(p => p.SupplierId).Title(" ").Template(@<text>
                                                                        @Html.ActionLink("View", "Edit", new { supplierId = @item.SupplierId.Value })
                                                                    </text>);
              //columns.Command(command => command.Edit()).Title(" ");
          })
      .Pageable()
      .Sortable()
      .Selectable()
      .DataSource(dataSource => dataSource.Server()
                                          .PageSize(GlobalVariables.DefaultPageSize)
                                          .Model(model =>
                                              {
                                                  model.Id(p => p.SupplierId);
                                              })
                                          .Read(read => read.Action("GetRejectedSuppliers", "Requestor"))
                                          .Update(update => update.Action("Edit", "Requestor"))
      ).Resizable(resize => resize.Columns(true))
      )
        And I have controller with four actions

public ActionResult GetNewSuppliers([DataSourceRequest] DataSourceRequest request)
{
    var data = service.GetSuppliersByStatus(SupplierStatusEntity.SavedDraft).Where(s => string.Equals(s.PINUserName, User.Identity.Name, StringComparison.OrdinalIgnoreCase)).Select(SupplierConverter.Convert);
    return Json(data.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
 
public ActionResult GetSubmittedSuppliers([DataSourceRequest] DataSourceRequest request)
{
    var data = service.GetSuppliersByStatus(SupplierStatusEntity.Submitted).Where(s => s.PINUserName == User.Identity.Name).Select(SupplierConverter.Convert);
    return Json(data.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
 
public ActionResult GetApprovedSuppliers([DataSourceRequest] DataSourceRequest request)
{
    var data = service.GetSuppliersByStatus(SupplierStatusEntity.Approved).Where(s => string.Equals(s.PINUserName, User.Identity.Name, StringComparison.OrdinalIgnoreCase)).Select(SupplierConverter.Convert);
    return Json(data.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
 
public ActionResult GetRejectedSuppliers([DataSourceRequest] DataSourceRequest request)
{
    var data = service.GetSuppliersByStatus(SupplierStatusEntity.Rejected).Where(s => s.PINUserName == User.Identity.Name).Select(SupplierConverter.Convert);
    return Json(data.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
But It does not work.

Is it possible to implement this variant?

1 Answer, 1 is accepted

Sort by
0
Gerry Connolly
Top achievements
Rank 1
answered on 10 Jun 2014, 07:56 AM
I found out solution
I changed dataSource => dataSource.Server() to
dataSource => dataSource.Ajax()
Tags
Grid
Asked by
Gerry Connolly
Top achievements
Rank 1
Answers by
Gerry Connolly
Top achievements
Rank 1
Share this question
or