The grid sort function does not work.

Hi,


I created an app using version 18.4.0.44 3 months ago.

At that time, the sort process when loading the page and the sort process when clicking the header were working.


Since then, the source of the app hasn't changed at all, but now the sort function doesn't work.

I updated to version 19.2.0.44 with NuGet and checked the app but it didn't work.

I also tried version 19.2.0.47 but it didn't work.


Please tell me how to resolve.

By the way, before, when I started the app, there was no error in DevTools of Chrome, but now I am getting the following error.


constants.js:111 Uncaught TypeError: Cannot read property 'length' of undefined

    at e.modelChanged (constants.js:111)

    at e.notify (constants.js:111)

    at t.notify (constants.js:111)

    at e.onPropertyChanged (constants.js:111)

    at e.notify (constants.js:111)

    at t.notify (constants.js:111)

    at t.extendedPropertyChange (constants.js:111)

    at t.onPropertyChanged (constants.js:111)

    at t.e.dataBind (constants.js:111)

    at t.dataBind (constants.js:111)



Regards,

Pylori.



5 Replies

RS Rajapandiyan Settu Syncfusion Team July 20, 2021 01:05 PM UTC

Hi Pylori 
  
Thanks for contacting Syncfusion support.  
  
We are tried to reproduce the reported scenario, but it was unsuccessful at our end. The Sorting action on EJ2 Grid is working properly with the latest version (19.2.47). We have created the sample for your reference. You can get it from the below link, 


Still, if you face the same issue, share the below details to replicate the problem at our end.  
  
  1. Share the full Grid code files (index.cshtml).
  2. Replication procedure of the reported behavior.
  3. Share the video demo of the reported behavior. 
  4. If possible, share the issue reproducible sample or try to make the issue in the given sample. 

Regards, 
Rajapandiyan S 



PY Pylori replied to Rajapandiyan Settu July 27, 2021 11:48 AM UTC

Hi,


Thanks for providing your sample.

I took a look at the sample and reconfirmed my source.


I have attached my source (_ClosedTradeActionsGrid.cshtml).

The sort function works when I delete lines 113 to 114 of my source that I attached.

This logic is for initial sorting.

It used to work with this source, but now it doesn't work anymore.


As a requirement, the function to switch the sort by clicking the header as before and the initial sort function when the page is displayed are required.

Please tell me how to achieve both.


Regards,

Pylori.



Attachment: _ClosedTradeActionsGrid_fc938582.zip


RS Rajapandiyan Settu Syncfusion Team July 28, 2021 12:19 PM UTC

Hi Pylori, 
  
Thanks for update. 
  
By analyzing your code example, we understood that you want to perform sorting at initial rendering of Grid, for that you executed sortColumn method in the created event of Grid. This is the cause of reported behavior. 
  
The created event of Grid triggered once the Grid’s rendering process started. In the meantime, we are not supposed to perform any Grid like Sorting, Filtering, etc., which refresh the Grid again before it rendered properly in the DOM and it leads rendering issue in Grid. 
  
We have inbuilt support for your requirement in which you can perform sorting at initial render. Find the below code example and documentation for your reference. 
  
  
  
[index.cshtml] 
  
@using Syncfusion.EJ2 
  
@{ 
  
    List<object> cols = new List<object>(); 
    cols.Add(new { field = "ShipCity", direction = "Descending" }); 
} 
  
  
@(Html.EJS().Grid("ej2ClosedTradeActionsGrid") 
            .AllowSorting() 
            .AllowMultiSorting() 
            .SortSettings(sort => sort.Columns(cols)) 
            .AllowSelection(false) 
            .AllowTextWrap() 
            .BeginEdit("beginEdit") 
            .Columns(col => 
            { 
                --- 
                col.HeaderText("取引時間") 
                    .DisableHtmlEncode(false) 
                    .Field("ShipCity") 
                    .TextAlign(Syncfusion.EJ2.Grids.TextAlign.Center) 
                    .Add(); 
                ---- 
            }).Render() 
) 
  

Please get back to us if you need further assistance with this.
 
  
Regards, 
Rajapandiyan S 



PY Pylori replied to Rajapandiyan Settu July 30, 2021 10:01 AM UTC

Hi,


I changed the source referring to your sample and the problem was solved.

Thank you for your support.


Regards,

Pylori.





RS Rajapandiyan Settu Syncfusion Team August 2, 2021 03:38 AM UTC

Hi Pylori, 
 
We are glad that the provided solution resolved your requirement. 

Please get back to us if you need further assistance. 
 
Regards, 
Rajapandiyan S 


Loader.
Up arrow icon