This is a migrated thread and some comments may be shown as answers.

What happens during a hidColumn call?

4 Answers 11 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 14 Oct 2015, 05:26 PM

I have a section of my code where I set the format for a column ({0:n3} in this case), and I can't get it to reflect in the grid unless I call hideColumn on a different column.

 

I set the column format like grid.columns[0].format = "{0:n3}"; then try to refresh the grid (grid.refresh()).  That doesn't reflect in the grid, but is set in the column properties and can be seen in debug mode.  Now when I go back and do a grid.hideColumn("SomeDifferentColumn") and refresh the grid, the formatting change is visible.

 

So what is going on in hideColumns that would make that become visible?

4 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 16 Oct 2015, 08:08 AM

Hello Matt,

 

The hideColumn() method changes the visibility property of the column, so this should not be affecting the Grid in the manner that you describe. Would it be possible to send us a Dojo where we can reproduce the issue?

 

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Matt
Top achievements
Rank 1
answered on 16 Oct 2015, 02:56 PM

I'll see what I can do to get a Dojo put together.  I'll have to scrub much of the data and simplify some of the code probably.

 The bulk of what we are trying to do is to have a user set a format at runtime in one grid for example {0:n3} and then apply that to another grid, so I guess I am asking how to set the format of a grid at runtime.

I have two columns in a grid inside a kendoWindow that are called format (Number, String, Date, Percent) and precision (number of decimal places).

I use edit functionality in this grid to allow the user to set the caption, visibility, format, and precision of a column in another grid.  When the user clicks update, I use the update event handler to update the other grid.  When I set the format for a column and refresh the grid nothing happens, but if I go back and hide a different column, the formatting change I had previously done is becomes visible.

0
Matt
Top achievements
Rank 1
answered on 16 Oct 2015, 03:19 PM

Here is the Dojo.  http://dojo.telerik.com/OfiSU

Steps to recreate:

1. Click edit on the Salary column.

2. Change format to number and precision to 4.

3. Click update. Notice that the column doesn't update

4. Click Edit on the Residence column

5. Set Hidden to Yes.

6. Click update.

7.  The salary column formatting is updated.

 

Why does this wait till step 6 to update instead of updating in step 3?

 

0
Kiril Nikolov
Telerik team
answered on 20 Oct 2015, 07:27 AM

Hello Matt,

 

Using the following expression will not update the column:

 

rptGrid.columns[j].format = "{0:n" + colCustData[i].precision + "}"

 

For changing Grid properties you need to use:

 

http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#methods-setOptions

 

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Matt
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Matt
Top achievements
Rank 1
Share this question
or