What is the correct way to add and remove columns inside another column at runtime in Ext JS?

283 views Asked by At

I want to build a grid that displays the number of hours an individual has worked where each column represents one day. Each day column should be inside a month column. In the gui I can select a start date and the grid should display one month -1 day worth of days, e.g.:

|     January    |     February    |
|Day6|.....|Day31|Day1|.......|Day5|

I have tried to delete the days inside a month column using destroy() on each day column, but when when the last day column is destroyed, the parent column (month) is also destroyed automagically (can I prevent this?).

I have also tried to delete the month columns and add new month columns containing day columns but this results in a very strange behavior, se example:

If i begin with this:

|     January    |     February    |
|Day6|.....|Day31|Day1|.......|Day5|

and delete January and February with destroy(), and straight after add new months containing the correct number of days I end up with duplicate of days in the grid like this:

|              January            |             February              |
|Day6|.....|Day31|Day6|.....|Day31|Day1|.......|Day5|Day1|.......|Day5|

As if the month column was never destroyed or as if the column was destroyed but the view is not updated correctly.

So to the question. What is the correct/best way to delete and add columns at runtime with the following requirements:

(At runtime when selecting a new start date:)

  1. Delete month column OR all day columns inside the month column.
  2. Create a new month column and populate with correct number of days OR add new day columns to the month column.

Thanks in advance!

0

There are 0 answers