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

Strange behavior with hidden column

1 Answer 45 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Collins
Top achievements
Rank 1
Collins asked on 27 May 2014, 03:51 PM
Hello,

we just faced a strange behavior with the Kendo UI Grid. We populated a Grid with no datasource at first. After some user action we change the datasource via jQuery like this: 

grid.kendoGrid({
dataSource : {
transport : {
read : {
url : "DrilldownReportApiRandom?type=" + type + "&id=" + id,
dataType : "json"
}
},
schema : {
data : "data",
total : "total"
}
}
});

We got one hidden column in the grid and after applying the datasource, the data of the hidden column will be shown, but not the colum title itself. This column gets the title of the first visible column, and the last correct column is missing the title. Strange uhh? 

Can anyone explain why?

The grid looks like this:

<kendo:grid name="grid_drilldown_adgroup" pageable="true">
<kendo:grid-pageable buttonCount="10" pageSizes="true"></kendo:grid-pageable>
<kendo:dataSource pageSize="10" serverPaging="true"></kendo:dataSource>
<kendo:grid-columns>
<kendo:grid-column hidden="true" title="campaignId" field="campaignId"></kendo:grid-column>
<kendo:grid-column template='<a class="adgroup_column" group="#=group#">#=group#</a>' title="group" field="group" ></kendo:grid-column>
<kendo:grid-column title="bidSMImpressions" field="bidSMImpressions" ></kendo:grid-column>
<kendo:grid-column title="bidSMClick" field="bidSMClick" ></kendo:grid-column>
<kendo:grid-column title="bidSMClicksPerBidSMImpression" field="bidSMClicksPerBidSMImpression" ></kendo:grid-column>
<kendo:grid-column title="bidSMCostPerBidSMClick" field="bidSMCostPerBidSMClick" ></kendo:grid-column>
<kendo:grid-column title="bidSMCost" field="bidSMCost" ></kendo:grid-column>
</kendo:grid-columns>
</kendo:grid>

Thanks in advance.

Jan

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 29 May 2014, 08:33 AM
Hello Jan,

Executing the kendoGrid() method creates a duplicate instance of the Grid widget attached to the same DOM element. Such a setup is not supported. You have three options:

1) fully configure the DataSource initially (you may want to set autoBind to false to prevent automatic initial data binding). If the DataSource requests will depend on some paratemeters, which are not known initially, you can add them on the fly via auxiliary functions:

http://docs.telerik.com/kendo-ui/api/wrappers/jsp/datasource/transport-read#event attributes-data

http://docs.telerik.com/kendo-ui/api/wrappers/jsp/datasource/transport-read#event attributes-url


2) create the Grid completely client-side


3) use the Grid's setDataSource method to assign a new fully configured DataSource instance. This is supported if the Grid columns and their settings remain the same.


Regards,
Dimo
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
Collins
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or