Kendogrid destroy()并在新数据源上重新创建表,为什么旧​​表列仍然存在? [英] Kendogrid destroy() and recreate the table on a new datasource, why do the old table columns still exist?

查看:244
本文介绍了Kendogrid destroy()并在新数据源上重新创建表,为什么旧​​表列仍然存在?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在KendoUI Grid中调用destroy(),然后在新的DataSource上重新创建表时:为什么旧表列仍然存在?

When invoking destroy() in KendoUI Grid and then recreate the table on a new DataSource: why do the old table columns still exist?

这里唯一保留发言权的元素是元素.我如何告诉网格读取新的数据源列(它读取其他所有正确的数据).

The only element here that stays the say is the element. How do I tell the grid to read the new datasource columns (it reads everything else correct).

(如果我制作2个不同的元素,它们都正确填充,但我宁愿保留1个元素,然后用destroy和reinit替换elements表)

(if I make 2 different elements, they both populate properly but I rather just keep 1 element and replace the elements table by destroy and reinit)

推荐答案

很可能是因为您没有清除Grid容器内的内容.例如

Most probably this is because you are not clearing the content inside the Grid container. e.g.

$('#gridName').data().kendoGrid.destroy();
$('#gridName').empty();

或更短的语法

$('#gridName').kendoGrid('destroy').empty();

网格以其他方式考虑剩余的旧html的方法-不要忘记可以从诸如

Other way the Grid takes into account the old html that is left - do not forget that the Grid could be initialized from table like here.

这篇关于Kendogrid destroy()并在新数据源上重新创建表,为什么旧​​表列仍然存在?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆