Login Register

Adding extra column to grid

Hi,
i'm trying to use dojox.grind for displaying data.
Everything works fine until i try to dinamically add columns to the table.
I need to add some columns and then refresh the table, then change the extra columns and refresh the data again.
When i need to rebuild the table header i acquire the base structure in json format from a file, then i add to it the extra columns.
The array composed by base structure + extra columns is passed as argumento to setStructure. So on it works, i see the new columns.

I try to do the same for the next search, but i can't because the original structure has been modified by some unknown entity... and i add the new extra columns at the previous structure, but i need to add them to the original structure.
I tryed to save the structure in others temp variables but i don't have the original data even using them..
It seems that something in grid modifies the variable containing the structure... is it possible?

Sorry for the confusion (maybe tomorrow i'll try to be more clear) and thanks for any advice..

Are you saving the base

Are you saving the base structure in a "global" variable? And not modifying it?

I found the problem. I

I found the problem.
I needed to modify the structure, mantaining the original one.
So i tryed to copy originalStructure in this way: var extraStructure = this.originalStructure
But this only created a pointer to the object, not a copy!

Now i do var extraStructure = dojo.clone(this.originalStructure); and it works.