I have a column that I want hidden conditionally based on user input. As I have my grid set up now, the column starts off hidden and everything displays properly, however if the user switches to make the hidden column visible, kendo grid just messes up its display:
01.
function
displayKendo(response){
02.
var
paymentMethod = $(
"#NS-pymntSchedule-payment-selector"
).val();
03.
var
hiddenInd =
false
;
04.
if
(paymentMethod ===
"getAll"
){
05.
hiddenInd =
true
;
06.
}
07.
var
grid = $(
"#NSpaymentKendo"
).kendoGrid({
08.
columns:[
09.
{headerAttributes:{
"class"
:
""
,style:
"text-align:left;font-weight:700;font-style:italic;"
,},width:45,
10.
},
11.
hidden:hiddenInd,
12.
},
13.
{title:
"Data 1"
,field:
"field1"
,headerAttributes:{
"class"
:
""
,style:
"text-align:left;font-weight:700;font-style:italic;"
,},},
14.
{title:
"Data 2"
,field:
"field2"
,headerAttributes:{
"class"
:
""
,style:
"text-align:left;font-weight:700;font-style:italic;"
,},},
15.
{title:
"Data 3"
,field:
"field3"
,headerAttributes:{
"class"
:
""
,style:
"text-align:left;font-weight:700;font-style:italic;"
,},},
16.
{title:
"Data 4"
,field:
"field4"
,headerAttributes:{
"class"
:
""
,style:
"text-align:left;font-weight:700;font-style:italic;"
,},},
17.
{title:
"Data 5"
,field:
"field5"
,headerAttributes:{
"class"
:
""
,style:
"text-align:left;font-weight:700;font-style:italic;"
,},},
18.
{title:
"Data 6"
,field:
"field6"
,headerAttributes:{
"class"
:
""
,style:
"text-align:left;font-weight:700;font-style:italic;"
,},},
19.
{title:
"Data 7"
,field:
"field7"
,headerAttributes:{
"class"
:
""
,style:
"text-align:left;font-weight:700;font-style:italic;"
,},},
20.
{title:
"Data 8"
,field:
"field8"
,headerAttributes:{
"class"
:
""
,style:
"text-align:left;font-weight:700;font-style:italic;"
,},},
21.
{title:
"Data 9"
,field:
"field9"
,headerAttributes:{
"class"
:
""
,style:
"text-align:left;font-weight:700;font-style:italic;"
,},},
22.
],
23.
dataSource:{
24.
data:response,
25.
pageSize:10,
26.
schema: {
27.
model: {
28.
fields:{},
29.
}
30.
},
31.
},
32.
pageable: {
33.
pageSizes:
true
,
34.
buttonCount: 5
35.
},
36.
columnMenu:
true
,
37.
allowCopy:
true
,
38.
sortable: {
39.
mode:
"multiple"
,
40.
allowUnsort:
true
,
41.
showIndexes:
true
42.
},
43.
reorderable:
true
,
44.
resizable:
true
,
45.
noRecords: {
46.
template:
"<br> No data available. <br>"
47.
},
48.
filterable:
true
,
49.
groupable:
true
,
50.
pageable: {
51.
refresh:
false
,
52.
pageSizes:
false
,
53.
buttonCount: 5
54.
},
55.
editable:
false
,
56.
})
57.
58.
grid.data(
"kendoGrid"
).refresh();
59.
}
Attached are screenshots showing before and after
Thanks, in advance.