react-timelines icon indicating copy to clipboard operation
react-timelines copied to clipboard

Feature/Help needed: Hide specific columns

Open ioncodes opened this issue 4 years ago • 2 comments

I'm using this to create a timeline based on weeks and days:

image

I used the following code to create the cells:

export const buildWeekCells = () => {
  const v = []
  for (let i = 0; i < 52; i += 1) {
    const week = moment().startOf('year').weekday(1).add(i, 'week')

    v.push({
      id: `w${i}`,
      title: `W${i}`,
      start: week.toDate(),
      end: week.add(1, 'week').subtract(2, 'day').toDate(),
    })
  }

  return v
}

export const buildDayCells = () => {
  const v = []
  for (let i = 0; i < 365; i += 1) {
    const day = moment().startOf('year').weekday(7).add(i, 'day')

    if (day.weekday() !== 6 && day.weekday() !== 0) {
      v.push({
        id: `d${i}`,
        title: day.toString()[0],
        start: day.toDate(),
        end: day.add(1, 'day').toDate(),
      })
    }
  }

  return v
}

I couldn't find a way to hide specific columns (in my case the weekends). This could be very useful. Any ideas on how to implement this?

ioncodes avatar Aug 13 '20 12:08 ioncodes

That would be an awesome feature ++

dakkusingh avatar Aug 19 '20 14:08 dakkusingh

Not sure exactly how it would interact with the event cell rendering, but I have #135 as a pull request that could be used to do something like this. Add class to weekend, then use css to shade or remove those cells.

lsbrillant avatar Oct 19 '20 22:10 lsbrillant