This is a migrated thread and some comments may be shown as answers.

Date Format RadForm DatePicker

1 Answer 83 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Steven
Top achievements
Rank 1
Steven asked on 01 Feb 2018, 09:09 AM

Hi Guys,

I know there is another post which is requesting that date format can be modified via metadata on the TKProperty which would be great.

In the mean time i have got this working as follows:  

  @ViewChildren('form') formCmps: QueryList<dataformAngularModule.RadDataFormComponent>;
  ngAfterViewInit(): void {
    var simpleDateFormat = new java.text.SimpleDateFormat("dd-MMM-yyyy", java.util.Locale.US);
    this.formCmps.changes.subscribe((comps:QueryList<dataformAngularModule.RadDataFormComponent>)=>{
      comps.forEach((form=>{
        //TNF FORM
        let datePicker: EntityProperty = form.dataForm.getPropertyByName("date");
        datePicker.editor.android.setDateFormat(simpleDateFormat);
      }));
    });
  }

 

The above works fine however i am struggling with using something similar in a child component.  For example

<StackLayout>
    <action-edd-cmp [model]="model" *ngIf="currentAction === 'edd'"></action-edd-cmp>

</StackLayout>

I know it is due to the lifecycle hooks but i dont know if there is any other way of setting dates in radform date picker?

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Steven
Top achievements
Rank 1
answered on 01 Feb 2018, 09:44 AM

Never mind guys - was able to get it working with 

<RadDataForm #form [source]="model" (editorUpdate)="onEditorUpdate($event)">

 

  public onEditorUpdate(args) {
    console.log('EDITOR UPDATED');
    if (args.propertyName === "propname") {
      args.editor.setDateFormat(this.simpleDateFormat);
    }
  }

Tags
DataForm
Asked by
Steven
Top achievements
Rank 1
Answers by
Steven
Top achievements
Rank 1
Share this question
or