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. Image for the cookie policy date

Resize Columns and don´t allow paging on Hierarchy Grid

I have a Grid with a ChildGrid, both of them with diferent datasources, and working fine.
When i try resize the columns, the grid resize previous column. i think that´s because i´m using child grid.

Another problem is when i don´t allow paging in child grid, and the lines disapear.

My code:

@(
 Html.EJ().Grid<object>("Grid_Pasta")
                    .Datasource(ds => ds.URL("../Pesquisa/Dados_Pasta").Adaptor(AdaptorType.UrlAdaptor))
                    .ClientSideEvents(e => e.RowSelected("BuscarDocs").DataBound("CarregaGrid"))                    
                    .Mappers(map => map.ExportToExcelAction(@Url.Action("./Pequisa/ExportToExcel"))
                                            .ExportToWordAction(@Url.Action("./Pequisa/ExportToWord"))
                                            .ExportToPdfAction(@Url.Action("./Pequisa/ExportToPdf"))
                                        )
                                        .AllowResizing()
                .ChildGrid(gridFilho =>
                {
                    gridFilho.Datasource(ds => ds.URL("../Pesquisa/Dados_Documentos").Adaptor(AdaptorType.UrlAdaptor))
                    .QueryString("Key")
                    .AllowPaging()
                    .ClientSideEvents(eve => eve.DataBound("CarregaGridFilho").RowSelected("AbrirDoc"))
                    .AllowResizing();
                })
                .AllowPaging()
                .AllowSorting()
                )


Attachment: ErrorGrid_2a5ad98e.7z

3 Replies

BM Balaji Marimuthu Syncfusion Team October 16, 2015 09:22 AM UTC

Hi Estevam,

Thanks for using Syncfusion Products.

Query 1: When i try resize the columns, the grid resize previous column. I think that´s because i´m using child grid.


By default the resizing is performed based on the total table width of Grid. So if we resize the columns in Grid other columns will be resize (width change) and we have already logged “Resizing the Columns width without changing the width of other columns” as a feature and it will be implemented in any of our releases.


Query 2: Another problem is when i don´t allow paging in child grid, and the lines disappear.


We have created a sample based on the provided code, but unable to reproduce the issue from our side. The ChildGrid is rendered properly without enabling the AllowPaging in Grid. Refer to the sample and code example:

SyncfusionMvcApplication27


[Controller]

 

public ActionResult ChildData(DataManager dm)

        {

            IEnumerable data = OrderRepository.GetAllRecords().Take(100).ToList();

            DataOperations operation = new DataOperations();

            if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting

            {

                data = operation.PerformSorting(data, dm.Sorted);

            }

            if (dm.Where != null && dm.Where.Count > 0) //Filtering

            {

                data = operation.PerformWhereFilter(data, dm.Where, dm.Where[0].Operator);

            }

            int count = data.AsQueryable().Count();  //return count


            //perform paging skip and take operation

            if (dm.Skip != 0)

            {

                data = operation.PerformSkip(data, dm.Skip);

            }

            if (dm.Take != 0)

            {

                data = operation.PerformTake(data, dm.Take);

            }

            return Json(new { result = data, count = count }, JsonRequestBehavior.AllowGet);

        }


@(Html.EJ().Grid<SyncfusionMvcApplication27.OrdersView>("FlatGrid")

          .Datasource(ds => ds.URL("/Grid/ParentGrid")

                     .Adaptor(AdaptorType.UrlAdaptor))

          .AllowPaging()    /*Paging Enabled*/

          .AllowResizing()

          .PageSettings(p => p.PageSize(4))

         

                  . . .

               .ChildGrid(child =>

                {

                    child.Datasource(ds => ds.URL("/Grid/ChildData")

                     .Adaptor(AdaptorType.UrlAdaptor))

                    .QueryString("EmployeeID")

                     .AllowResizing()

                                               

                    . . .

                })

)




Please check the above sample and still if you face same the issue, share the following details to find the cause of issue and provide better solution at the earliest.


1.     Console error screenshot if any.

2.     Essential Studio/Browser version details.

3.     Modify the provided sample as issue reproducible.


Regards,

Balaji Marimuthu



EM Estevam Michael Ferraz Campos October 16, 2015 03:01 PM UTC

Thanks for answer my doubt, but i think you don´t understood exactly which is my issue.

At the first issue, the problem occurs when i put the Child Grid on the main grid. Before child grid, columns resize works perfectly. After Child Grid, one column is created for the arrow to expand grid, and that´s the problem, because when i resize the column, the grid changes previous column size..

The other problem is ChildGrid with the property AllowPaging(true) works correctly, but when i remove that property or set it false, the records are not shown.
I don´t nedd paging child grid because i never will be more than 1 record.

Attached  the videos showing what happens.

Thanks again.

Attachment: Videos_2b06b67e.7z


BM Balaji Marimuthu Syncfusion Team October 19, 2015 10:41 AM UTC

Hi Estevam,
  
Query:1 At the first issue, the problem occurs when i put the Child Grid on the main grid. Before child grid, columns resize works perfectly. After Child Grid, one column is created for the arrow to expand grid, and that´s the problem, because when i resize the column, the grid changes previous column size..

We have already logged “Resizing the Columns width without changing the width of other columns” in Grid as a feature. While implementing this feature, we will consider the reported requirement “Resize not work when put the childGrid” and it will be implemented in any of our releases.
 
Query:2 The other problem is ChildGrid with the property AllowPaging(true) works correctly, but when i remove that property or set it false, the records are not shown.I don´t nedd paging child grid because i never will be more than 1 record.
 
We have checked by disabling the AllowPaging property (Removing the AllowPaging) in ChildGrid but the ChildGrid was rendered properly.  We have recorded a video for your reference, AllowPaging
 
Refer to the sample in following link: SyncfusionMvcApplication27_(3)

To achieve your requirement, set the offline property as true in DataSource. Refer to the code example.

@(Html.EJ().Grid<object>("FlatGrid")

          .Datasource(ds => ds.URL("/Grid/ParentGrid")

                     .Adaptor(AdaptorType.UrlAdaptor))

          .AllowPaging()    /*Paging Enabled*/

          .AllowResizing()

          .PageSettings(p => p.PageSize(4))

          .AllowSorting()


               .ChildGrid(child =>

                {

                    child.Datasource(ds => ds.URL("/Grid/ChildData").Offline(true)

                     .Adaptor(AdaptorType.UrlAdaptor))

                    .QueryString("EmployeeID");

                              })
)

public ActionResult ChildData(DataManager dm)

        {

            IEnumerable data = OrderRepository.GetAllRecords().Take(100).ToList();

            DataOperations operation = new DataOperations();

           

            . . .


           return Json(data, JsonRequestBehavior.AllowGet);
        }



We suspect that you have not used the PerformWhereFilter method in server side. If the UrlAdaptor used as dataSource (Not Enabled the offline property) for ChildGrid, the filtering operation has to be performed in server side. Data will filter based on the QueryString property in server side.
 
 

 @(Html.EJ().Grid<object>("FlatGrid")

          .Datasource(ds => ds.URL("/Grid/ParentGrid")

                     .Adaptor(AdaptorType.UrlAdaptor))


                . . .

               .ChildGrid(child =>

                {

                    child.Datasource(ds => ds.URL("/Grid/ChildData").

                     .Adaptor(AdaptorType.UrlAdaptor))

                    .QueryString("EmployeeID");

                              })
)

 

public ActionResult ChildData(DataManager dm)

        {

            IEnumerable data = OrderRepository.GetAllRecords().Take(100).ToList();

            DataOperations operation = new DataOperations();

            if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting

            {

                data = operation.PerformSorting(data, dm.Sorted);

            }

            if (dm.Where != null && dm.Where.Count > 0) //Filtering

            {

                data = operation.PerformWhereFilter(data, dm.Where, dm.Where[0].Operator);

            }

            int count = data.AsQueryable().Count();  //return count

 

            //perform paging skip and take operation

            if (dm.Skip != 0)

            {

                data = operation.PerformSkip(data, dm.Skip);

            }

            if (dm.Take != 0)

            {

                data = operation.PerformTake(data, dm.Take);

            }

            return Json(new { result = data, count = count }, JsonRequestBehavior.AllowGet);
        }
 


 
Refer to the Document to perform server side operation: 
http://www.syncfusion.com/kb/4300/server-side-api-for-datamanager-operations
 
If you still face any issue, please share the following details to proceed further. 
 

1.  Server full code example of view and controller file.

2.  Console error screenshot if any (Please check the console in development tool)

3.  How you returned data source in server side? 

4.  Essential Studio/Browser version details.

5.   Modify the sample as issue reproducible.
 
Kindly provide the above details which will helpful to find the cause of issue and provide better solution at the earliest.
 
Regards,
Balaji Marimuthu


Loader.
Live Chat Icon For mobile
Up arrow icon