syncfusion / ej2-react-ui-components

Syncfusion React UI components library offer more than 50+ cross-browser, responsive, and lightweight react UI controls for building modern web applications.
https://www.syncfusion.com/react-ui-components
Other
349 stars 103 forks source link

Scheduler - collapse ResourceDirective by default #132

Closed karlrez closed 1 year ago

karlrez commented 1 year ago

I am creating a similiar scheduler to this example

I am looking to have the projects collapsed by default. I see the default value is "Expanded" but I cannot find what String is sopposed to go there for collapsed state.

Also, is it possible to add an onClick handler to this?

<ResourceDirective
   field="ProjectId"
   title="Choose Project"
   name="Projects"
   allowMultiple={false}
   dataSource={projectData}
   textField="text"
   idField="id"
   colorField="color"

   // these two props don't do anything 
   onClick = { () => console.log('on click') }
   expandedField="Collapsed"
/>
Satheeshkumar0195 commented 1 year ago

Hi @karlrez,

https://stackblitz.com/edit/react-nuauqd-d84yaf?file=index.js

what String is supposed to go there for collapsed state.

You can collapse all the resources by using the expandedField property, as shown in the below shared snippet.

Api: https://ej2.syncfusion.com/react/documentation/api/schedule/resources/#expandedfield

image

Also, is it possible to add an onClick handler to this?

And you can add the onClick into the resource header using resourceHeaderTemplate, as shown in the below shared snippet.

Api: https://ej2.syncfusion.com/react/documentation/api/schedule#resourceheadertemplate

UG: https://ej2.syncfusion.com/react/documentation/schedule/resources#simple-resource-header-customization

image

gsumankumar commented 1 year ago

Hi @karlrez , We trust that the provided solution has successfully addressed the matter. Should you encounter any further issues or have any inquiries, please do not hesitate to reach out to us for further assistance.