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

Grid date format Problem!

Thread ID:

Created:

Updated:

Platform:

Replies:

151251 Feb 5,2020 07:06 AM UTC Feb 10,2020 05:42 AM UTC Angular - EJ 2 3
loading
Tags: Grid
Tümer
Asked On February 5, 2020 07:06 AM UTC

When i apply date format from ts file grid data is not shown. Contrary when i removed on html grid works and data is shown. In addition i applied pageSettings and there is no problem with it. What is the problem ?

<kt-portlet [class]="'kt-portlet--height-fluid'">
  <kt-portlet-header [title]="'Order Statistics'">
  </kt-portlet-header>
  <kt-portlet-body>
    <div class="control-section">
      <ejs-grid [dataSource]='gridDataSource' allowPaging='true' height=365  [pageSettings]='initialPage' >
          <e-columns>
              <e-column field='description' headerText='Paket Adı' width='120' textAlign='Right'></e-column>
              <e-column field='price' headerText='Ücret' width='150'></e-column>
              <e-column field='createdAt' headerText='Oluşturulma Tarihi' [format] = 'formatoptions' width='130' textAlign='Right'></e-column>                    
          </e-columns>
      </ejs-grid>  
    </div>
  </kt-portlet-body>
</kt-portlet>






@Component({
  selector: 'kt-packagegroups',
  templateUrl: './packagegroups.list.component.html',
  styleUrls: ['./packagegroups.list.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush
})

export class PackageGroupsListComponent implements OnInit {

  packageGroupsIPackageGroup[] = [];
  gridDataSourceObject[] = [];
  public formatoptions = { format: 'dd/MM/yyyy' }  
  public initialPage = { pageSizes: truepageCount: 4 }; 
  
  constructor(private dataServicePackageDataServiceprivate packageGroupServicePackageGroupServiceprivate cdrChangeDetectorRef) {
  }

  ngOnInit() {      
    this.packageGroupService.getPackageGroups().subscribe(response => {
      this.gridDataSource = response;
    }); 
    this.cdr.detectChanges();            
  }
}

Dhivya Rajendran [Syncfusion]
Replied On February 5, 2020 08:46 AM UTC

Hi Tümer, 
 
Greeting from Syncfusion support. 
 
We have validated the provided information and we suspect that the first value of the date column might be null or undefined so that it cause the reported problem. By, default, when you are not specified the type for the column then it considered from the first value of the column so we suggest you to specify the type for column to resolve the problem. 
 
<ejs-grid [dataSource]='data' height='350'> 
  <e-columns> 
      <e-column field='OrderID' headerText='Order ID' width='120' textAlign='Right'></e-column> 
      <e-column field='CustomerName' headerText='Customer Name' width='150'></e-column> 
      <e-column field='OrderDate' headerText='Order Date' type='date' width='130' [format]="format" textAlign='Right'></e-column> 
  </e-columns> 
</ejs-grid> 
 
 
export class AppComponent { 
  public data: Object[] = []; 
  public format = {type:'date', format:'dd/MM/yyyy'} 
} 
 
 
 
 
If you still face the problem then bind actionFailure event for grid and get back to us with the arguments details that will help us to validate further at our end. 
 
 
Regards, 
R.Dhivya 


Tümer
Replied On February 8, 2020 10:59 AM UTC

Hi Dhivya,

That's working now. Thank you!

Bests,
Tümer


Dhivya Rajendran [Syncfusion]
Replied On February 10, 2020 05:42 AM UTC

Hi Tümer, 
 
Thanks for your update. 
 
We are happy to hear that the provided suggestion was helpful to resolve the problem. Please get back to us if you require further assistance. 
 
Regards, 
R.Dhivya 


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

Live Chat Icon For mobile
Live Chat Icon