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

Render Grid data and properties dynamically

With reference to this Dynamic Grid, rendering the grid dynamically.
I pass datsource of type datatable and all columns through Viewbag.
1. When I want add some properties to grid, it gives below error:
"Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type."

Code snippet is as below:  Error is coming for all properties wherever lamba expression is involved.
Eg. Export, SummaryRow, Grouping etc.
@(Html.EJ().Grid< System.Data.DataTable > ("Grid")
                        .Datasource((System.Data.DataTable)ViewBag.dataSource)
                        .Columns(ViewBag.cols) //use the columns ViewBag
                        .CommonWidth(100)
                        .SortSettings(sort => sort.SortedColumns(col => col.Field("Datum").Direction(SortOrder.Descending).Add()))
                        .GroupSettings(group => { group.GroupedColumns(col => { col.Add("Datum"); }); })
)

2. Properties are not reflecting for column: It's not able to format datetype.
  new Column() { Field = "Datum", HeaderText = "Eventdatum",Format ="{0:dd/MM/yyyy}", TextAlign=Syncfusion.JavaScript.TextAlign.Left,Type="date" }

3. Can we specify in Field values with spaces like that :
Field = "Datum & Rate"

4. In general or in dynamic grid:
     A. Can we give different colors for alternate Rows?
     B. Can we give alternate colors for grouped  rows when grid is grouped over one column ?


Please help me out with this.

18 Replies

VN Vignesh Natarajan Syncfusion Team February 8, 2019 10:49 AM UTC

Hi Vaibhav, 
 
Thanks for contacting Syncfusion Support. 
 
Query#1:- 1. When I want add some properties to grid, it gives below error:"Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type." 
 
We have analyzed the reported query and we are able to reproduce your reported problem at our end. To overcome this problem we suggest you to define columns ViewBag after sortSettings and GroupSettings definition. Please refer to the code example:- 
 
@(Html.EJ().Grid<object>("FlatGrid") 
            .Datasource((System.Data.DataTable)ViewBag.dataSource) 
            .AllowSorting() 
            .AllowGrouping() 
            .SortSettings(sort => sort.SortedColumns(col => col.Field("OrderID").Direction(SortOrder.Descending).Add())) 
            .GroupSettings(group => { group.GroupedColumns(col => { col.Add("Name"); }); }) 
            .AllowPaging() 
            .ShowColumnChooser() 
            .ClientSideEvents(events => events.Load("load")) 
            .Columns(ViewBag.cols) 
    ) 
 
 
Query#2:-  Properties are not reflecting for column: It's not able to format datetype 
 
We can reproduce your reported problem at our end. While defining the date value on serverside, it will returns the date in the form of String so format is not applied to the column with given date format. To overcome this problem, we have changed string into date object using Load event of the Grid. 
 
Please refer to the code example:- 
@(Html.EJ().Grid<object>("FlatGrid") 
         .Datasource((System.Data.DataTable)ViewBag.dataSource) 
         .AllowSorting() 
                 .   .     .    
         .ClientSideEvents(events => events.Load("load")) 
         .Columns(ViewBag.cols) 
                 
 
) 
<script> 
    function load(args) { 
        for (var i = 0; i <= args.model.columns.length; i++) { 
            if (args.model.columns[i].type == "date") { 
                for (var i = 0; i < this.model.dataSource.length; i++) { 
                    this.model.dataSource[i].OrderDate = new Date(this.model.dataSource[i].OrderDate); 
                 } 
            } 
        } 
    } 
</script> 
 
 
For your convenience we have prepared a sample using above solutions. Kindly download the sample from below link 
 
 
Refer our API documentation for your reference 
 
 
 
Query#3:- Can we specify in Field values with spaces like that :Field = "Datum & Rate" 
 
You can specify the column with fieldname with special Characters. It will load that particular column dataSource to Grid. But while performs actions like CRUD operations filtering and sorting issue will occur.  
So we suggest you to use FieldName without using spaces.  
 
Regards, 
Vignesh Natarajan 
 



VM Vaibhav More February 11, 2019 08:48 AM UTC

Thanks for your reply.

1.When I want add some properties to grid, it gives below error:"Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type."

It is working fine.

2:-Properties are not reflecting for column: It's not able to format datetype

If I use code provided it is casting date as NaN. When I am not using the code it displays date correctly as string date.

I was able to fix this. It was java script error for casting date.

-- I am trying to cast the Column value whose type is given as Number to integer using parseint. Though it doesn't give error and correct values are shown. When I click on sort it is not sorting properly.

It takes only first char and sort according to it.

3:-Can we specify in Field values with spaces like that :Field = "Datum & Rate"

The column names are dynamic. So I am providing data through Datatable but I don't see it binding data to columns.

Eg . 4er Bob & Standard

4er Bob & Undefined

4er Bob & Standard

Gästefahrten & Standard

4. Can we specify Summary row and column:

One summary row for each column and One Vertical Summary Column for each row. (Horizontally and Vertically both which sums to same value at edge point.)

(All Columns names are dynamic. Present in ViewBag)

Similarly page wise summary too when pagination is enabled.

5.In general or in dynamic grid:

A. Can we give different colors for alternate Rows?

-- I was able overwrite css for it.

B. Can we give alternate colors for grouped rows when grid is grouped over one column ?

--Couldn't find proper solution for it.



VN Vignesh Natarajan Syncfusion Team February 11, 2019 08:56 AM UTC

Hi Vaibhav, 
 
Thanks for the update. 
 
Query2:Though it doesn't give error and correct values are shown. When I click on sort it is not sorting properly.” 
 
From your query, we understand that you are facing issue while sorting the date column. The reported issue will occur when the date value is not in form of DateObject. You have mentioned that you converted number to integer. Instead we suggest you to change the number to Date object using new Date() in the load event as suggest in previous update.  
 
Note: new Date(“2/10:2019) will work only when date value (input string) is given in form of MM/dd/YYYY.  Ensure that you have define the date value as Date Object.  
 
Query 3:- The column names are dynamic. So I am providing data through Datatable but I don't see it binding data to columns. 
 
We have used JS-render to render the grid. So, we must use only valid JavaScript name characters for the grid-id and field name. Due to the above reason the data is not bind to the grid. If you want to use the special characters in the field name then use the valid JavaScript name characters  (a-z, A-Z, 0-9, _, $). 
 
Also, refer the below Knowledge base help documentation link, 
 
 
So we suggest you to use FieldName without using spaces to achieve the CRUD actions. 
 
Query 4:-  Can we specify Summary row and column One summary row for each column and One Vertical Summary Column for each row. (Horizontally and Vertically both which sums to same value at edge point.) 
(All Columns names are dynamic. Present in ViewBag)Similarly page wise summary too when pagination is enabled. 
 
From you query, we understand that you need to display the summary below each group and total at bottom of ejGrid. We have given support for groupSummary  , captionSummary.  
 
Please refer the below help documentation links, 
 
 
Also refer the below links for demo, 
 
 
 
Query 5: In general or in dynamic grid: A. Can we give different colors for alternate Rows? B. Can we give alternate colors for grouped rows when grid is grouped over one column ? 
 
We have already discussed the same in the our knowledge base documentation.  
 
Please refer the below link, 
 
 
Please get back to us if you have further queries. 
 
Regards, 
Vignesh Natarajan 
 



VM Vaibhav More February 12, 2019 09:29 AM UTC

Thanks for your quick reply.
Query2: “Though it doesn't give error and correct values are shown. When I click on sort it is not sorting properly.
This is about the new dynamic column whose type is number. Sorting is not working for it.
I found that though casting of date is done properly. Sorting is not working correctly. Date column is being treated as String and sorting is done according to alphanumeric order.
Also, if date column value is null it gives error while exporting "String was not recognized as a valid DateTime.".
How can we handle this error ?
How can we make when date column is sorted all empty value rows for that column will be always last in ASC/DESC order?

 Query: Can we specify Summary row and column One summary row for each column and One Vertical Summary Column for each row. (Horizontally and Vertically both which sums to same value at edge point.) 
(All Columns names are dynamic. Present in ViewBag)Similarly page wise summary too when pagination is enabled. 

- Here , all the column names are dynamic so I can't write column name explicitly in the grid. I want display output like :

Date Col1 Col2 Col3 Total
11-Feb-19 1 2 3 6
11-Feb-19 4 5 6 15
11-Feb-19 7 8 9 24
   11-Feb-19 12 15 18 45
12-Feb-19 1 4 7 12
12-Feb-19 2 5 8 15
12-Feb-19 3 6 9 18
   12-Feb-196 15 24 45
 (No date value)  18  30  42 90

Update- Currently I added manually the expected rows and columns for the sum , by passing through datasource. I am getting expected output in the grid. But when I am trying to export 
I get error as "String was not recognized as a valid DateTime.", cause as shown above Date column doesn't have any value.
How do I handle it and make export work?

Query: Can we give alternate colors for grouped rows when grid is grouped over one column ? 
I will try out this and update.
--I am not able to give particular class to give different background colors for grouped row.


Please help me out with this.



VN Vignesh Natarajan Syncfusion Team February 12, 2019 01:33 PM UTC

Hi Vaibhav, 
 
Query : This is about the new dynamic column whose type is number. Sorting is not working for it. 
 
The mentioned issue may occur when the type for the columns are given wrongly. So, we suggest you to set the correct type for the columns in the columns definition or in the DataTable definition. Please refer the below code example. 
 
 
 
            DataColumn cl = new DataColumn("No",typeof(int)); 
            dt.Columns.Add(cl); 
            cl = new DataColumn("Name",typeof(string)); 
            dt.Columns.Add(cl); 
            cl = new DataColumn("OrderID",typeof(int)); 
            dt.Columns.Add(cl); 
            cl = new DataColumn("ShipCity",typeof(string)); 
            dt.Columns.Add(cl); 
            cl = new DataColumn("OrderDate"); 
            dt.Columns.Add(cl); 
 
 
(OR) in the columns definition as   given below. 
 
List<Column> cols = new List<Column>();// Column is a class of Syncfusion Javascript models 
            cols.Add(new Column() { Field = "No", HeaderText = "No", Type="number" });//Add some column 
            cols.Add(new Column() { Field = "Name", HeaderText = "Name" }); 
            cols.Add(new Column() { Field = "OrderID", HeaderText = "Order ID", Type="number" }); 
            cols.Add(new Column() { Field = "OrderDate", HeaderText = "Order date", Format = "{0:MM/dd/yyyy}", Type="date"}); 
 
 
Query : when I am trying to export I get error as "String was not recognized as a valid DateTime.", cause as shown above Date column doesn't have any value. 
 
We are not able to reproduce this issue on our side. We have prepared a sample with the date column value as null in a row, but the exporting is working fine on our side. 
 
Please share the following details. 
 
  1. Share the Essential studio versions details.
  2. Share the Grid model which is obtained in the ExportToExcel method in the server side.
  3. If possible please try to reproduce the issue in the attached sample.
 
Query : One summary row for each column and One Vertical Summary Column for each row.  
 
By default we have support to show the summary rows for columns using the summaryRows property of the Grid. To show the vertical summary column we have added the virtual column in the load event and we have shown the sum of the number type column values in the added virtual column using queryCellInfo event. 
 
Please refer the below code example. 
 
 
 
@(Html.EJ().Grid<object>("FlatGrid") 
                    .Datasource((System.Data.DataTable)ViewBag.dataSource) 
                    .AllowSorting() 
                    .AllowGrouping() 
                    .ShowSummary(true) 
                    .AllowMultiSorting() 
                    .GroupSettings(group => { group.GroupedColumns(col => { col.Add("OrderID"); }); }) 
                    .AllowPaging() 
                    .ShowColumnChooser() 
                    .ClientSideEvents(events => events.Load("load”).QueryCellInfo("querycellinfo")) 
                    .ToolbarSettings(toolBar => toolBar.ShowToolbar().ToolbarItems(items => 
                    { 
                        items.AddTool(ToolBarItems.ExcelExport); 
                        items.AddTool(ToolBarItems.WordExport); 
                        items.AddTool(ToolBarItems.PdfExport); 
                    })) 
                    .Columns(ViewBag.cols) 
) 
<script> 
    function load(args) { 
 
        args.model.columns.push({  headerText: "Total", width: 60 }); 
 
 
        var summarycolumns = []; 
 
        for (var i = 0; i < args.model.columns.length; i++) { 
            
            if (args.model.columns[i].field == "OrderID") { 
                summarycolumns.push({ summaryType: ej.Grid.SummaryType.Sum, dataMember: args.model.columns[i].field, displayColumn: args.model.columns[i].field }); 
            } 
        } 
 
        args.model.summaryRows = [{ title: "Sum", summaryColumns: summarycolumns }]; 
 
        for (var i = 0; i <= args.model.columns.length; i++) { 
            if (args.model.columns[i].type == "date") { 
                for (var i = 0; i < this.model.dataSource.length; i++) { 
                    if (this.model.dataSource[i].OrderDate != null) 
                    this.model.dataSource[i].OrderDate = new Date(this.model.dataSource[i].OrderDate); 
                 } 
            } 
        } 
    } 
 
 
    var numberdata = [], sum = 0; 
 
    function querycellinfo(args) { 
         
        if (args.column.type == "number") { 
            numberdata.push(args.rowData[args.column.field]); 
        } 
        if (args.column.headerText == "Total") { 
            for (var i = 0; i < numberdata.length; i++) { 
                sum = sum + numberdata[i]; 
            } 
            args.cell.innerHTML = sum; 
            numberdata = []; sum = 0; 
        } 
    } 
 
   
</script> 
 
 
Query: “I am not able to give particular class to give different background colors for grouped row. 
 
We have achieved your requirement using queryCellInfo event of ejGrid. Refer the below code example 
 
var color = []; 
    for (var i = 0; i < 12; i++) { 
        color.push(getRandomColor()); 
    } 
    function getRandomColor() { 
        var letters = '0123456789ABCDEF'; 
        var color = '#'; 
        for (var i = 0; i < 6; i++) { 
            color += letters[Math.floor(Math.random() * 16)]; 
        } 
        return color; 
    } 
…………………………………………………………………… 
 
 
    var numberdata = [], sum = 0; 
 
    function querycellinfo(args) { 
        if (args.model.groupSettings.groupedColumns.length) { 
            var data = args.model.currentViewData; 
            var jsondata = this._currentJsonData; 
            for (var i = 0; i < data.length; i++) { 
                for (var j = 0; j < data[i].items.length; j++) { 
                    var index = jsondata.indexOf(data[i].items[j]); 
                    this.getRowByIndex(index).css("background-color", color[i]); 
                } 
            } 
        } 
        if (args.column.type == "number") { 
            numberdata.push(args.rowData[args.column.field]); 
        } 
        if (args.column.headerText == "Total") { 
            for (var i = 0; i < numberdata.length; i++) { 
                sum = sum + numberdata[i]; 
            } 
            args.cell.innerHTML = sum; 
            numberdata = []; sum = 0; 
        } 
    } 
 
Refer our help documentation for your reference 
 
 
For your convenience we have prepared a sample with above solution. Kindly refer the below link for the sample. 
 
 
Regards, 
Vignesh Natarajan 
 



VM Vaibhav More February 20, 2019 07:03 AM UTC

Query : This is about the new dynamic column whose type is number. Sorting is not working for it. 
This one is resolved.

Query : when I am trying to export I get error as "String was not recognized as a valid DateTime.", cause as shown above Date column doesn't have any value. 
This is handled by replacing the date type from gridmodel to string/empty.
GridModel = GridModel.Replace("\"type\":\"date\"", "\"type\":\"\"");

Query : One summary row for each column and One Vertical Summary Column for each row.  
Manually, I added the expected data (Sum rows for group, Vertical sum and total sum row) to data table. It is working fine.

Query: “I am not able to give particular class to give different background colors for grouped row. 
Still, its not working.
"querycellinfo" is not getting called. Do i need to add something more ?

Thanks


VN Vignesh Natarajan Syncfusion Team February 21, 2019 07:22 AM UTC

Hi Vaibhav, 
 
Thanks for the update. 
 
Query: ” querycellinfo" is not getting called. Do i need to add something more ?”  
 
From your query,  we understand that queryCellInfo event is not getting triggered. We suspect that ClientSideEvents is not initialized in the Grid. Refer the below code example 
 
@(Html.EJ().Grid<object>("FlatGrid")  
                    .Datasource((System.Data.DataTable)ViewBag.dataSource)  
                    .AllowSorting()  
                    .AllowGrouping()  
                    .ShowSummary(true)  
                    .AllowMultiSorting()  
                    .GroupSettings(group => { group.GroupedColumns(col => { col.Add("OrderID"); }); })  
                    .AllowPaging()  
                    .ShowColumnChooser()  
                    .ClientSideEvents(events => events.Load("load”).QueryCellInfo("querycellinfo"))  
                    .ToolbarSettings(toolBar => toolBar.ShowToolbar().ToolbarItems(items =>  
                    {  
                        items.AddTool(ToolBarItems.ExcelExport);  
                        items.AddTool(ToolBarItems.WordExport);  
                        items.AddTool(ToolBarItems.PdfExport);  
                    }))  
                    .Columns(ViewBag.cols)  
)  
<script>  
……………………………………. 
  
    var numberdata = [], sum = 0;  
  
    function querycellinfo(args) {  
          
        if (args.column.type == "number") {  
            numberdata.push(args.rowData[args.column.field]);  
        }  
        if (args.column.headerText == "Total") {  
            for (var i = 0; i < numberdata.length; i++) {  
                sum = sum + numberdata[i];  
            }  
            args.cell.innerHTML = sum;  
            numberdata = []; sum = 0;  
        }  
    }  
  
    
</script>  
 
 
If you still facing issue, Kindly ensure is there any script error in console. If yes, Share the details regarding the issue you are facing. 
 
Regards, 
Vignesh Natarajan 



VM Vaibhav More February 21, 2019 09:23 AM UTC

Thanks for your reply.

It works fine after adding ClientSideEvents.

But,
1. I find that it doesn't work when grid is grouped over 2 or more than 2 columns.
Also, pager is selected to show more rows (from 10 to 100). Color doesn't reflect on the newly shown rows. (Remaining 90 here.)

2. Similarly, when Summary row is added to grid and is grouped over more than 1 column. The grid shows correct data in the grid as [per grouping, but it is exported to excel the summary rows pertaining to grouped columns (from No.2 .... n) doesn't appear.
Hence inconsistency is there in data between grid and excel.
Is this issue? Or Am I missing something ?

Thanks for the help.



VN Vignesh Natarajan Syncfusion Team February 25, 2019 03:50 PM UTC

Hi Vaibhav, 

Sorry for the inconvenience.  

Query : I find that it doesn't work when grid is grouped over 2 or more than 2 columns. 
 
When the columns are grouped this current view data is updated dynamically based on the grouped columns fields in a hierarchy manner. So it is not feasible to apply the solution to the columns which are grouped dynamically by dragging and dropping. 


Query 2 : The grid shows correct data in the grid as [per grouping, but it is exported to excel the summary rows pertaining to grouped columns (from No.2 .... n) doesn't appear.  
 
Please share the following details before we proceed with your query. 

  1. Share the screenshot of the exported excel sheet and grid.
  2. Share the code example of the Grid in both client side and server side.
  3. Share the Essential studio versions details.

Regards, 
Vignesh Natarajan. 




VM Vaibhav More replied to Vignesh Natarajan February 26, 2019 04:56 AM UTC

Hi Vaibhav, 

Sorry for the inconvenience.  

Query : I find that it doesn't work when grid is grouped over 2 or more than 2 columns. 
 
When the columns are grouped this current view data is updated dynamically based on the grouped columns fields in a hierarchy manner. So it is not feasible to apply the solution to the columns which are grouped dynamically by dragging and dropping. 


Query 2 : The grid shows correct data in the grid as [per grouping, but it is exported to excel the summary rows pertaining to grouped columns (from No.2 .... n) doesn't appear.  
 
Please share the following details before we proceed with your query. 

  1. Share the screenshot of the exported excel sheet and grid.
  2. Share the code example of the Grid in both client side and server side.
  3. Share the Essential studio versions details.

Regards, 
Vignesh Natarajan. 



Query 2 : The grid shows correct data in the grid as [per grouping, but it is exported to excel the summary rows pertaining to grouped columns (from No.2 .... n) doesn't appear.  
 
Please share the following details before we proceed with your query. 

  1. Share the screenshot of the exported excel sheet and grid.
  2. Share the code example of the Grid in both client side and server side.
  3. Share the Essential studio versions details - Visual Studio 2017
Please find attachment of screenshot.

Client-side code is simple to render the grid.

ExcelAction :

                ExcelExport exp = new ExcelExport();
                List<EventData> currentEvents;
                object DataSource;
                currentEvents = eventService.GetAllForDateRange(searchAndPaging);
                DataSource = mapper.Map<List<EventModel>>(currentEvents);
                GridProperties obj = (GridProperties)Syncfusion.JavaScript.Utils.DeserializeToModel(typeof(GridProperties), GridModel);
                obj.SortSettings.SortedColumns.Clear();
                exp.Export(obj, DataSource, $"{searchAndPaging.ReportType}.xlsx", ExcelVersion.Excel2016, false, false, "flat-saffron");
            

Attachment: Screenshots_dca463d0.zip


VM Vaibhav More February 26, 2019 09:38 AM UTC

Also, I observed that, as everything is rendered dynamically and involves more calculations on server side, page load is taking time of 30 seconds to 60 seconds.
I tried applying loading GIF on the grid, but wasn't able to achieve it.

Is there way to show that data is still loading in the grid?
I am showing the data in the same page after post-back/Get request. (Using form action in Razor MVC).


VN Vignesh Natarajan Syncfusion Team February 27, 2019 01:11 PM UTC

Hi Vaibhav, 
 
Thanks for the update. 
 
Query 2 : The grid shows correct data in the grid as [per grouping, but it is exported to excel the summary rows pertaining to grouped columns (from No.2 .... n) doesn't appear.   
 
From the shared screenshot we are able to see that the Verrechnung:Startgeld group caption items positions are changed from Grid UI and excel exporting file (i.e. in the export file the Disziplin:skeleton shows first and Disziplin:Rodel Einer shows second but in the grid UI it shows in the reverse order).  
 
And also from the screenshot we could see that in the grid UI the Ascending order sorting is applied to the Disziplin column. So, it shows in the order like Disziplin:Rodel Einer(first) and Disziplin:skeleton(second). But in the server end, ExcelAction method you have cleared the sorting in the grid model. Due to this the order mismatch is occur. To overcome the reported issue, kindly remove the line related to clearing the sortSettings in server side while exporting. 
 
Note: we have provided the above suggestion based on the screenshot differs only. So, if we misunderstood your query please get back to us with more details. 
 
Query: Is there way to show that data is still loading in the grid? 
 
While using remote data, waitingpopup will shown default when there is time delay in fetching the data from server. For local data we can show grid loading status using waiting popup manually. 
 
Please refer the below code, 
 
 
    var gridobj = $("Grid").ejGrid("instance");  // use your grid id here. 
 
         gridobj.element.ejWaitingPopup("show");  // show the waiting popup 
 
         gridobj.element.ejWaitingPopup("hide");  // hide the waiting popup 
 
 
 
Regards, 
Vignesh Natarajan.. 
 



VM Vaibhav More February 28, 2019 06:49 AM UTC

Query 2 : The grid shows correct data in the grid as [per grouping, but it is exported to excel the summary rows pertaining to grouped columns (from No.2 .... n) doesn't appear. 
I found where sorting order was getting cleared. It's corrected but still issue persists. PFA of updated screenshots. (Gridmodel and Images).

The sorting was cleared manually for 1 grid. There issue was: 'String was not recognized as a valid DateTime.'
Because last row has null value for Date column. PFA of excel data. Is there another way to handle it ?

 Query: Is there way to show that data is still loading in the grid? 
 
Below code not seems to be working. ejWaitingPopup method is not found in the instance of grid.

Attachment: data_1b1f7307.zip


SE Sathyanarayanamoorthy Eswararao Syncfusion Team March 4, 2019 03:32 PM UTC

Hi Vaibhav, 

Query : The grid shows correct data in the grid as [per grouping, but it is exported to excel the summary rows pertaining to grouped columns (from No.2 .... n) doesn't appear.  
 
We have confirmed that the mentioned issue “Group Summary is not displayed in the exported excel sheet ” is a bug and have logged a defect report for the same. The fix for this issue will be included in the release 2019 Volume 1 SP1 which is expected to be rolled out in the month of April 2019. We appreciate your patience until then. 
  
Query : ejWaitingPopup method is not found in the instance of grid. 
Sorry for the inconvenience caused. 
In the previous code example that we have provided we have missed the # character while taking the grid instance so the grid instance is not obtained which may be the cause of the issue. Please refer the below code example. 
 

    
var gridobj = $("#Grid").ejGrid("instance");  // use your grid id here.  
  
         gridobj.element.ejWaitingPopup("show");  // show the waiting popup  
  
         gridobj.element.ejWaitingPopup("hide");  // hide the waiting popup  
  
  
If you still face the issue please share the code example after applying the suggested solution. 

Query : 'String was not recognized as a valid DateTime.'Because last row has null value for Date column. 
 
Please share the following details. 
 
  1. Please share the stack trace of the exception.
  2. Share whether the exception is thrown when the grid is exported.
  3. (Or) when the grid is exported after performing sorting.

Regards, 
Sathyanarayanamoorthy 



VM Vaibhav More March 7, 2019 11:51 AM UTC

Query : The grid shows correct data in the grid as [per grouping, but it is exported to excel the summary rows pertaining to grouped columns (from No.2 .... n) doesn't appear.  
We will be awaiting for the fix. Thanks.

Query : 'String was not recognized as a valid DateTime.'Because last row has null value for Date column. 
  1. Please share the stack trace of the exception.
  2. Share whether the exception is thrown when the grid is exported.
  3. (Or) when the grid is exported after performing sorting.
PFA of file.
The grid is exported with either ASC or DESC sorting order of Date and grouped by DateColumn.

When grouped by is removed it exports properly irrespective of sort order (ASC/DESC).


Attachment: data_6607321.zip


VN Vignesh Natarajan Syncfusion Team March 8, 2019 03:00 PM UTC

Hi Vaibhav, 

We have analyzed your query and prepared sample as per your code example but we are unable to reproduce your reported problem at our end when we export the Grid with grouped column. Refer to the sample Link:- 
  

We need some additional information to find the cause of the issue. Share us the following details. 

1. Complete Grid code example(both in client and server side). 
2. Stringified model of the Grid on server side while on Exporting as like below screenshot and copy it into clipboard. 
  
3. How you bind dataSource for dateColumn(form of string or dateObject). 
4.  Share us the Grid model view.  

Regards, 
Vignesh Natarajan. 





VM Vaibhav More March 11, 2019 05:59 AM UTC

1. Complete Grid code example(both in client and server side). 
2. Stringified model of the Grid on server side while on Exporting as like below screenshot and copy it into clipboard. 
PFA.

3. How you bind dataSource for dateColumn(form of string or dateObject). 
-- Column is of Date type in datatable and in Grid.
Initially the dynamic datatable is formed and last row is added for Sum of Columns where date is supposed to be empty.
So it is added as below:
DataColumn dtColumn = new DataColumn("Eventdatum")
            {
                DataType = typeof(DateTime) //System.Type.GetType("System.DateTime")
            };
 FinalRow["Eventdatum"] = DBNull.Value;

Later, Datatable is bound to Grid.


Dynamic list of columns is passed to grid :
Date column is added as below:
{
                           new Column() { Field = "Eventdatum", HeaderText = "Eventdatum",Format ="{0:dd/MM/yyyy}",
                               TextAlign =Syncfusion.JavaScript.TextAlign.Left,Type="date", AllowSorting=true,
                               ValidationRules=new Dictionary<string, object>(){
                                   //{ "Compare", new object(){}}
                                    {"required",true}
                               }
                           }


PFA of required files.


Attachment: data_3ec73b37.zip


VN Vignesh Natarajan Syncfusion Team March 13, 2019 01:01 PM UTC

Hi Vaibhav, 
 
Sorry for the inconvenience caused. 
 
Query: “String was not recognized the valid DateTime Exception.” 
 
We have validate the defect “Grid throws exception when exporting the Grouped data with dataTable and Datetime column” you have initiated with us. Thank you for taking the time to report this issue and helping us improve our product. At Syncfusion, we are committed to fixing all the validated defects (subject to technological feasibility and Product Development Life Cycle) and including the detect fix  in our Volume 1 2019 Service Pack 1 release which is expected to be rolled out in the month end of April 2019.  
    
You can now track the current status of your request review the proposed resolution timeline and contact us for any further enquiries through this link.   
 
 
Note: Currently the feedback is in review and it will be visible to once completed. 
 
Until then we appreciate your patience.   
 
Regards, 
Vignesh Natarajan. 
 
 


Loader.
Live Chat Icon For mobile
Up arrow icon