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.
Unfortunately, activation email could not send to your email. Please try again.

Hierarchial Grid: QueryString not appended to childgrid datasource

Thread ID:

Created:

Updated:

Platform:

Replies:

123703 Apr 12,2016 09:17 PM Apr 18,2016 04:43 AM JavaScript 3
loading
Tags: ejGrid
Krishna
Asked On April 12, 2016 09:17 PM

Hi,

I am having trouble getting a hierarchial grid working using URL adaptor. Essentially the querystring does not get appended to the child grid datasource. Some code below if that's useful.

var dataManager = ej.DataManager({
                url: "/Reminders/Get?startDate=" + startDate + "&endDate=" + endDate,
                adaptor: new ej.UrlAdaptor()
            });
            var notificationsDataManager = ej.DataManager({
                url: "/Reminders/Notifications",
                adaptor: new ej.UrlAdaptor()
            });
            $("#remindersGrid").ejGrid({
                dataSource: dataManager,
                columns: [
                    { field: "Id", headerText: "Id", isPrimaryKey:true, visible:false},
                    ......        
                ],
                allowPaging: true,
                childGrid: {
                    dataSource: notificationsDataManager,
                    queryString: "Id",
                    columns: [
                        ......
                    ],
                    allowPaging: true
                }
            });
    public ActionResult Get(DateTime? startDate, DateTime? endDate)
        {
            var reminders = _remindersProvider.GetReminders(DateTime.Now, DateTime.Now);
            return Json(new { result = reminders, count = reminders.Count() }, JsonRequestBehavior.AllowGet);
        }       
       
        public ActionResult Notifications(int id)
        {
            var notifications = _remindersProvider.GetReminderNotifications(id);
            return Json(new { result = notifications, count = notifications.Count() }, JsonRequestBehavior.AllowGet);
        }

Any help will be greatly appreciated.

Thanks,
Krishna



Prasanna Kumar Viswanathan [Syncfusion]
Replied On April 13, 2016 08:05 AM

Hi Krishna,

Thanks for contacting Syncfusion support.

We created a sample in hierarchical grid using URL Adaptor and we able to append the child grid using queryString.  In your code snippet, we found that you have mentioned the id as a parameter in the controller. So, we suggest you to use DataManager as a parameter in the controller. DataManager parameter contains all the required parameters for  performing server side operations such as paging, sorting, searching and filtering. We suggest you to use Execute method of DataOperations class for performing server side operations.

When we open the child grid the dataManager parameter contains the query under where property of dataManager and filter the data.

Please find the screenshot:

 

Please find the code example and sample:


<script type="text/javascript">

    var dataManager = ej.DataManager({

        url: "/Grid/DataSource",

        adaptor: new ej.UrlAdaptor()

    });

    var notificationsDataManager = ej.DataManager({

        url: "/Grid/DataSource2",

        adaptor: new ej.UrlAdaptor()

    });

    $("#FlatGrid").ejGrid({

        dataSource: dataManager,

        allowSorting: true,

        columns: [

               ---------------------------------------

       ],

        childGrid: {

            dataSource: notificationsDataManager,

           queryString: "EmployeeID",

            allowPaging: true,

            columns: [

              ---------------------------------------

           ],

           

        },


    });


</script>


Sample: http://www.syncfusion.com/downloads/support/forum/123703/ze/Sample118577-743703497

Regards,
Prasanna Kumar N.S.V


Krishna
Replied On April 16, 2016 08:47 AM

Thanks Prasanna, works.

Thanks,
Krishna

Prasanna Kumar Viswanathan [Syncfusion]
Replied On April 18, 2016 04:43 AM

Hi Krishna,
 
We are happy that the provided solution working fine at your end.
 
Regards,

Prasanna Kumar N.S.V

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.

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.

;