Code Monkey home page Code Monkey logo

Comments (8)

ekvalheim avatar ekvalheim commented on September 2, 2024 1

Creating new items array works. Thanks.

from react-calendar-timeline.

xmityaz avatar xmityaz commented on September 2, 2024

I guess you can specify visibleTimeStart and visibleTimeEnd properties. And on date-picker change you can just overwrite visibleTime* values.
But in case you using visibleTime* properties, you would also need to specify onTimeChange method for them

from react-calendar-timeline.

ekvalheim avatar ekvalheim commented on September 2, 2024

Hi

I also want to use a date-picker. But when updating visibleTimeStart and visibleTimeEnd, I get the following error: "Unable to get property 'dimensions' of undefined or null reference" if the new date contains any items. Is this because the sortedDimensionItems is not updated if the items list and the groups list are unchanged?

Espen

from react-calendar-timeline.

xmityaz avatar xmityaz commented on September 2, 2024

Hi, @ekvalheim
Possible reason of this error could be mutating of timeline items array. It should be immutable value. If you're changing the items array directly, try to create new array which contains old and new items (possibly with .concat method)

from react-calendar-timeline.

mariusandra avatar mariusandra commented on September 2, 2024

Looks like this is fixed? Thank you @xmityaz for responding! :)

from react-calendar-timeline.

talon-himself avatar talon-himself commented on September 2, 2024

@ekvalheim would you be able to post some example code of how you implemented this?

from react-calendar-timeline.

ekvalheim avatar ekvalheim commented on September 2, 2024

@T-Hughes
jsx:

<Timeline
   groups={groups}
   items={items}
   calendarDate={calendarDate}
   visibleTimeStart = {moment(calendarDate)
     .startOf('day')
     .hour(8).valueOf()}
   visibleTimeEnd={moment(calendarDate)
     .startOf('day')
     .hour(20).valueOf()}
/>

<DateTimePicker
  value={calendarDate}
  onChange={dateChange}
/>

In the dateChange function, the calendarDate property is updated, and the items array is populated with new data received from web api.

items: action.meetings.map((object) => ({
   id: object.Id,
   group: object.GroupId,
   start_time: moment(object.Start),
   end_time: moment(object.End),
   canMove: false,
   canResize: false,
   className: object.FreeBusyStatus === 0 ? 'free' : 'standard',
   title: object.Subject,
}))

from react-calendar-timeline.

talon-himself avatar talon-himself commented on September 2, 2024

Thanks @ekvalheim !

from react-calendar-timeline.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.