We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Two grid on same page with datamanager

Thread ID:

Created:

Updated:

Platform:

Replies:

145175 Jun 7,2019 07:46 AM UTC Jun 13,2019 10:48 AM UTC ASP.NET MVC - EJ 2 9
loading
Tags: Grid
Massimo
Asked On June 7, 2019 07:46 AM UTC

Hi, how can I have two grid on the same page that load data with 

dataManager.Url("/Home/UrlDatasourceProducts").Adaptor("UrlAdaptor").InsertUrl("/Home/InsertProducts").UpdateUrl("/Home/UpdateProducts").RemoveUrl("/Home/DeleteProducts");}

and 

dataManager.Url("/Home/UrlDatasourceList").Adaptor("UrlAdaptor").InsertUrl("/Home/InsertList").UpdateUrl("/Home/UpdateList").RemoveUrl("/Home/DeleteList");}

Thank you.

Manivannan Padmanaban [Syncfusion]
Replied On June 10, 2019 08:28 AM UTC

Hi Massimo, 

Thanks for contacting Syncfusion Support. 

Query: Two grid on same page with dataManager. 

From the above query, we are able to understand that you want to render the two grids within the same page with dataManager UrlAdaptor. For your convenience we have created the sample, kindly refer the below link. 

If we misunderstood your query, please get back to us with the below details. 

  1. Explain your requirement in detail. Also, confirm whether are you using the Asp.net MVC platform. If not, please share the platform are you using.
 
Regards, 
Manivannan Padmanaban. 



Massimo
Replied On June 10, 2019 02:10 PM UTC

Hi, I understand with your example where was my fault.
I've a last question regards this two grids with 
first grid:
dataManager.Url("/Home/UrlDatasourceProducts").Adaptor("UrlAdaptor").InsertUrl("/Home/InsertProducts").UpdateUrl("/Home/UpdateProducts").RemoveUrl("/Home/DeleteProducts");}
...
col.Field("Id").HeaderText("Id").IsPrimaryKey(true).Visible(true).Width("150").Add();
col.Field("Product").HeaderText("Product").Visible(true).Width("150").Add();
...

second grid:
dataManager.Url("/Home/UrlDatasourceList").Adaptor("UrlAdaptor").InsertUrl("/Home/InsertList").UpdateUrl("/Home/UpdateList").RemoveUrl("/Home/DeleteList");}
...
col.Field("Id").HeaderText("Id").IsPrimaryKey(true).Visible(false).Width("100").Add();
col.Field("IdProduct").HeaderText("IdProduct").Visible(true).Width("100").AllowEditing(false).Add();
col.Field("Product").HeaderText("Product").ForeignKeyField("IdProduct").ForeignKeyValue("Product").Visible(true).Width("150").AllowEditing(false).Add();

How can reach the render of the column Product in the second grid? This Product column is the Product column of the first grid joined by Products.Id = List.IdProduct
Actually the column is render empty.
Thank you.




Manivannan Padmanaban [Syncfusion]
Replied On June 11, 2019 06:10 AM UTC

Hi Massimo, 

Thanks for the update. 

Query: How can reach the render of the column Product in the second grid? This Product column is the Product column of the first grid joined by Products.Id = List.IdProduct 
Actually the column is render empty. 
 
We suspect that the above reported issue(column is render empty) will occur because you have not defined the dataSource for the foreignkey column. Kindly refer the below links, 



Regards, 
Manivannan Padmanaban.  



Massimo
Replied On June 11, 2019 06:29 AM UTC

Hi Manivannan,
thanks for the fast reply.
You're right. Is missing the dataSource similar to:
.DataSource((IEnumerable<object>)ViewBag.dataSource2)

but, how can reach the correct dataSource when there are remote data like as:

public ActionResult UrlDatasourceProducts(DataManagerRequest dm)
        {
            ModelEntities db = new ModelEntities();
            IEnumerable DataSource = db.Table02_Products.ToList();
            DataOperations operation = new DataOperations();
            if (dm.Search != null && dm.Search.Count > 0)
            {
                DataSource = operation.PerformSearching(DataSource, dm.Search);  //Search
            }
            if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting
            {
                DataSource = operation.PerformSorting(DataSource, dm.Sorted);
            }
            if (dm.Where != null && dm.Where.Count > 0) //Filtering
            {
                DataSource = operation.PerformFiltering(DataSource, dm.Where, dm.Where[0].Operator);
            }
            int count = DataSource.Cast<Table02_Products>().Count();
            if (dm.Skip != 0)
            {
                DataSource = operation.PerformSkip(DataSource, dm.Skip);   //Paging
            }
            if (dm.Take != 0)
            {
                DataSource = operation.PerformTake(DataSource, dm.Take);
            }
            return dm.RequiresCounts ? Json(new { result = DataSource, count = count }) : Json(DataSource, JsonRequestBehavior.AllowGet);
        }

Regards,


Manivannan Padmanaban [Syncfusion]
Replied On June 11, 2019 07:14 AM UTC

Hi Massimo, 

Thanks for the update. 

Query: but, how can reach the correct dataSource when there are remote data like as: 

We can define the remote data for the grid column dataSource as like below, 


@(Html.EJ().Grid<object>("Editing") 
………………………………………………. 
……………………………………… 
            .Columns(col => { 
                    ……………………………….. 
                    col.Field("EmployeeID").HeaderText("Employee ID").ForeignKeyField("EmployeeID").ForeignKeyValue("FirstName") 
                        .DataSource(ds => ds.URL("/Grid/ColumnData").Adaptor(AdaptorType.UrlAdaptor)).AllowEditing(true) 
                        .EditType(EditingType.DropdownEdit) 
                        .FilterType(FilterOption.Excel) 
                    …………………………………………………….. 
                }) 
 
) 

  public ActionResult ColumnData(DataManager value) 
        { 
………………………………………………….. 
        } 



Regards, 
Manivannan Padmanaban. 


Massimo
Replied On June 11, 2019 08:15 AM UTC

Hi Manivannan,
is not clear for me the ………………………………………………….. in the ActionResult ColumnData
May I have a EJS little example please?
Regards,

Pavithra Subramaniyam [Syncfusion]
Replied On June 12, 2019 04:23 PM UTC

Hi Massimo, 

As per your request we have created a foreignKey column sample in EJ2Grid and you can find that sample from the below link, 

 
Regards, 
Pavithra S. 


Massimo
Replied On June 13, 2019 05:57 AM UTC

Hi Pavithra,
this example solve my problem.
Thank you very much!

Pavithra Subramaniyam [Syncfusion]
Replied On June 13, 2019 10:48 AM UTC

Hi Massimo, 

Thanks for your update. 

We are glad to hear that your problem has been resolved. 

Please get back to us if you need any further assistance on this. 
 
Regards, 
Pavithra S. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon