美文网首页存蓄已解决的‘漏洞’
如何移除动态加载的数据

如何移除动态加载的数据

作者: 痛心凉 | 来源:发表于2018-11-29 16:44 被阅读0次

    当你使用插件库的时候,他们的方法和数据都是动态加载,如果它们不加载完,你就无法获取到,移除它就更不可能。下面有一个方法避免这个坑。(这个是我用的Ext插件库遇到的

        var treeGrid = new Ext.ux.tree.TreeGrid({
                id: "xtgl005LT",
                style:"margin-right:10px",
                autoScroll: true,
                autoHeight: true,
                border: false,
                animate: true,
                enableDD: true,
                sortable:false,
                columns: [
                    {
                        header: '模板名称',
                        dataIndex: 'nodeName',
                        width: 150,
                        align:'center', stopSelection: false
                    }
                ],
                loader: treeloader,
                listeners:{
                    render:function () {
                    },
                    afterRender:function () { //表格加载完之后执行的
                        //表头点击时的列表,只显示两个
                        $("#xtgl005LT table thead").on('click',function () {
                            setTimeout(function () {
                                $("#xtgl005LT-hctx ul").css({
                                    "heigth":"45px !important",
                                });
                                $("#xtgl005LT-hctx").prev(".x-show").css({
                                    "heigth":"48px !important",
                                });
                                $("#xtgl005LT-hctx ul li:eq(2)").remove();
                            },0)
                        })
                    }
                }
            })
    

    只需要一次性计时器setTimeout(function (){},0)这个就达到我们要的效果了。

    相关文章

      网友评论

        本文标题:如何移除动态加载的数据

        本文链接:https://www.haomeiwen.com/subject/cypfcqtx.html