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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

hide GMT time for date column in grid

Thread ID:

Created:

Updated:

Platform:

Replies:

141228 Nov 30,2018 08:46 AM UTC Nov 30,2018 12:31 PM UTC ASP.NET MVC - EJ 2 8
loading
Tags: Grid
Nivas
Asked On November 30, 2018 08:46 AM UTC

Hi Team,

I have grid and loading data from Data table as below.

 @Html.EJS().Grid("Grid").DataSource((DataTable)ViewBag.FFReport).AllowFiltering().AllowMultiSorting(true).PageSettings(page => page.PageSizes(new List<object>() { 5, 10,15,20,25,30 })).AllowTextWrap(true).AllowPaging(true).AllowExcelExport(true).AllowResizing(true).Height("400").AllowExcelExport().ToolbarClick("toolbarClick").Toolbar(new List<string>() { "ExcelExport" }).FilterSettings(filter => { filter.Type(Syncfusion.EJ2.Grids.FilterType.Excel); }).AllowGrouping(false).Render()

How to hide the GMT time stamp in date columns.



Mohammed Farook J [Syncfusion]
Replied On November 30, 2018 09:33 AM UTC

Hi Nivas, 
 
Thanks for contacting Syncfusion support. 
 
 
We have validated your requirement and we found from your code, you can generate the column based on the dataSource.  So if we using auto generated column, we need to set the format for the date Column. Please find the code example for your reference. 
 
Code example 
 
 
 
 
@Html.EJS().Grid("Grid").DataBound("dataBound").DataSource((DataTable)ViewBag.FFReport).AllowFiltering().AllowMultiSorting(true).PageSettings(page => page.PageSizes(new List<object>() { 5, 10, 15, 20, 25, 30 })).AllowTextWrap(true).AllowPaging(true).AllowExcelExport(true).AllowResizing(true).Height("400").AllowExcelExport().ToolbarClick("toolbarClick").Toolbar(new List<string>() { "ExcelExport" }).FilterSettings(filter => { filter.Type(Syncfusion.EJ2.Grids.FilterType.Excel); }).AllowGrouping(false).Render() 
 
<script> 
    function dataBound() { 
        for (var i = 0; i < this.columns.length; i++) { 
            if (this.columns[i].type == 'date' || this.columns[i].type == 'datetime') { 
                this.columns[i].format = { type: 'date', format: 'dd/MM/yyyy' }; 
            } 
 
        } 
        this.refreshColumns(); 
    } 
</script> 
 
 
 
Here we have applied the format for date column by using ‘format’ property in “load” event of Grid. 
 
 
This is not meet your requirement , could you please explain more details about your requirement. 
 
Regards, 
J Mohammed Farook 


Nivas
Replied On November 30, 2018 09:49 AM UTC

Great, its working. thanks. 


Nivas
Replied On November 30, 2018 10:03 AM UTC

hi grid get hang when i load 10 records...Horizontal and vertical bar not moving 

Mohammed Farook J [Syncfusion]
Replied On November 30, 2018 10:23 AM UTC

 Hi Nivas,  
 
Thanks for you update. 
We are happy to hear that the provided solution was helpful to achieve your requirement. 
 
Query : grid get hang when i load 10 records...Horizontal and vertical bar not moving 
Please find the demo for enable scrolling in Grid.  
By default scrolling can be appears and working when the Grid content is exceed than height / width.  Still if you have facing same issue could you please share the following details 
  1. Share the full grid code example with your data.
  2. Share which version of  EJ2 script and DLL version used in your application?
  3. Share the sample if it possible .
  4. Share the console window if have any script error thrown
 
 
Regards, 
J Mohammed Farook 


Nivas
Replied On November 30, 2018 11:30 AM UTC


refreshColumns(); 

Refresh the grid every time when there is movement in grid. so  grid moving to initial potion.


if i remove refresh from the script its working fine but the date format change not reflecting.

Mohammed Farook J [Syncfusion]
Replied On November 30, 2018 11:42 AM UTC

Hi Nivas, 
 
Sorry for inconvenience cause. 
 
We have validated the reported issue and we found the root cause of issue due to called “refreshColumn” method continuously. For avoid this issue we can check the Grid is initial load or not while load event . Please update following code in your application. 
 
 
  
 
 
@Html.EJS().Grid("Grid").Load("load").DataBound("dataBound").DataSource((DataTable)ViewBag.FFReport).AllowFiltering().AllowMultiSorting(true).PageSettings(page => page.PageSizes(new List<object>() { 5, 10, 15, 20, 25, 30 })).AllowTextWrap(true).AllowPaging(true).AllowExcelExport(true).AllowResizing(true).Height("400").AllowExcelExport().ToolbarClick("toolbarClick").Toolbar(new List<string>() { "ExcelExport" }).FilterSettings(filter => { filter.Type(Syncfusion.EJ2.Grids.FilterType.Excel); }).AllowGrouping(false).Render() 
 
<script> 
    var initialLoad = false; 
    function load() { 
        initialLoad = true; 
    } 
    function dataBound() { 
        if (initialLoad) { 
            initialLoad = false; 
            for (var i = 0; i < this.columns.length; i++) { 
                if (this.columns[i].type == 'date' || this.columns[i].type == 'datetime') { 
                    this.columns[i].format = { type: 'date', format: 'dd/MM/yyyy' }; 
                } 
 
            } 
            this.refreshColumns(); 
        } 
    } 
</script> 
 
 
Regards, 
J Mohammed Farook 


Nivas
Replied On November 30, 2018 11:52 AM UTC

working fine, Thanks for the help....


Mohammed Farook J [Syncfusion]
Replied On November 30, 2018 12:31 PM UTC

Hi Nivas,  
Thanks for the update.   
 
We are happy to hear that your problem has been resolved. 
 
Regards, 
J Mohammed Farook 


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

;