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

查看:17
本文介绍了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 个元素并通过销毁和重新初始化替换元素表)

(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();

Grid 考虑剩下的旧 html 的其他方式 - 不要忘记可以从表中初始化 Grid,例如 此处.

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天全站免登陆