calendar - adding a required rule to devextreme scheduler - Angular -
i'am using angular , devextreme scheduler's plugin make google calendar app. when create appointment, i've made custom form. subject / date / , select box select person. force required rules subject using function :
calendar.component.ts:
onappointmentformcreated(data: any) { console.log(data) let form = data.form; form.itemoption("text","isrequired",true); } i tryed force required method selectbox using method described. on devextreme scheduler's documentation found nothing useful. tryed use dx form validator method doing : calendar.component.html
<dx-scheduler [showalldaypanel]="false" [datasource]="appointmentsdata" appointmenttemplate="appointmenttemplate" [views]='["agenda","workweek"]' startdateexpr="startdate" enddateexpr="enddate" currentview="workweek" textexpr="text" [firstdayofweek]="1" [startdayhour]="9" [enddayhour]="18" width="100%" [height]="1100" (onappointmentformcreated)="onappointmentformcreated($event)" (onappointmentadding)="creatingappointment($event)" (onappointmentadded)="createappointment($event)" (onappointmentupdated)= "updatingappointment($event)" (onappointmentdeleted)= "deletingappointment($event)"> <dx-date-box [value] = "date" > <dxo-display-format type="shortdatefr"></dxo-display-format> </dx-date-box> <div *dxtemplate="let appointment of 'appointmenttemplate'"> <i>{{appointment.text}} -- </i> <b>{{appointment.ownername}}</b> </div> <dxi-resource fieldexpr="ownerid" label="personne" [datasource]="persondata"> <dx-validator> <dxi-validation-rule type="required" message="person required"></dxi-validation-rule> </dx-validator> </dxi-resource> </dx-scheduler> adding calendar module:
import .... dxvalidatormodule,dxvalidationsummarymodule like saw here : https://js.devexpress.com/demos/widgetsgallery/demo/validation/overview/angular/light/ ( country )
i add required validator function selectbox don't know how... need please. much
i quess method should work. make sure specified correct fieldname:
form.itemoption('ownerid', 'isrequired', true);
Comments
Post a Comment