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

Question about append data on existing table.

1 Answer 206 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kyriakos
Top achievements
Rank 1
Kyriakos asked on 24 Jan 2013, 11:33 AM
Hi,  i'm currently using a ajax call to append the TH and TD rows on a table template and then using the table ID i use the kendo grid to stylize it. 

my template is the following :
<table cellpadding="0" cellspacing="0" border="0" class="display" id="data-table{id}" width="100%" role="grid" data-role="grid">
<thead>
<tr id="append_head{id2}">

</tr>
</thead>
<tbody id="append_data{id3}">

</tbody>
</table>

if i hard code data into the head TR and in the tbody and then append the table on the HTML  and then use the :
$("# data-table" + id).kendoGrid({
   });
it works flawlessly .

But if i attach the TH and the TD rows using ajax and then  then append the table on the HTML  and then use the :
$("# data-table" + id).kendoGrid({
   });

then the fuctionally of the table is broken and also is not displaying correctly.

Can you please tell me if im doing something wrong? or missing something?

thanks

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 28 Jan 2013, 09:51 AM
Hello Kyriakos,

Thank you for getting in touch with us.

The problem you described is caused by the multiple initialization of the widget which is not supported. The Grid should be initialized only once. To add rows at a later point simply append the HTML to the Grid's tbody. In order to display they correctly you should set the corresponding CSS class names.

Here is a small example: http://jsbin.com/uripor/2/edit

Please note that each alternate row should have class k-alt. I hope this information will help.

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