• ext的grid 获取页面内容方式


    Ext.onReady(function() {
                var url = "jasonGrid.aspx?Param=select&obj=ActiveCourseList";
                //字段列
                var fields =
                [
                   { name: 'title' },
                   { name: 'subject' },
                   { name: 'context' },
                   { name: 'restype' },
                   { name: 'tename' },
                   { name: 'teschool' },
                   { name: 'pubtime' },
                   { name: 'discusnum' },
                   { name: 'clicknum' },
                   { name: 'oper' },
                   { name: 'resid' }
                ];

                //绑定数据源
                var store = new Ext.data.Store
                ({
                    remoteSort: true,
                    proxy: new Ext.data.HttpProxy({ url: url }),
                    reader: new Ext.data.JsonReader({ totalProperty: "totalPorperty", root: "root", fields: fields })
                });

                store.on('beforeload', function() {  
                   this.baseParams["txtkeyword"] = Ext.get("txtkeyword").dom.value;
                   this.baseParams["ddlgradeTxt"] = Ext.get("ddlgradeTxt").dom.value;
                   this.baseParams["ddlsubjectTxt"] = Ext.get("ddlsubjectTxt").dom.value;
                   this.baseParams["ddlusertypeTxt"] = Ext.get("ddlusertypeTxt").dom.value;
                   this.baseParams["ddlformatVal"] = Ext.get("ddlformatVal").dom.value;
                   this.baseParams["ddlrestypeVal"] = Ext.get("ddlrestypeVal").dom.value;
                   this.baseParams["txtsize"] = Ext.get("txtsize").dom.value;
                   this.baseParams["txttecfirstname"] = Ext.get("txttecfirstname").dom.value;
                   this.baseParams["txtteclastname"] = Ext.get("txtteclastname").dom.value;
                   this.baseParams["txttecunit"] = Ext.get("txttecunit").dom.value;
                   this.baseParams["ddltecsubjectTxt"] = Ext.get("ddltecsubjectTxt").dom.value;
                   this.baseParams["txtupfirstname"] = Ext.get("txtupfirstname").dom.value;
                   this.baseParams["txtuplastname"] = Ext.get("txtuplastname").dom.value;
                   this.baseParams["txtupunit"] = Ext.get("txtupunit").dom.value;
                   this.baseParams["ddlupsubjectTxt"] = Ext.get("ddlupsubjectTxt").dom.value;
                   this.baseParams["hdresid"] = Ext.get("hdresid").dom.value;
                   this.baseParams["hdkeyid"] = Ext.get("hdkeyid").dom.value;
                   this.baseParams["hdknowlegeid"] = Ext.get("hdknowlegeid").dom.value;
                   this.baseParams["IsOld"] = Ext.get("IsOld").dom.value;
                   this.baseParams["hd"] = Ext.get("hd").dom.value;

                }); 
                //分页
                var pagingBar = new Ext.PagingToolbar
                ({
                    displayInfo: true, emptyMsg: "没有数据显示", displayMsg: "显示从{0}条数据到{1}条数据,共{2}条数据",
                    store: store,
                    pageSize: 25
                });


                // 编辑列
                function editor(val) {
                    return '<a href=\"###\" onclick=viewresource(\"' + val + '\")>查看</a><a href=\"###\" onclick=downresource(\"' + val + '\")>下载</a><a href=\"###\" onclick=recresource(\"' + val + '\")>推荐</a><a href=\"###\" onclick=shcangresource(\"' + val + '\")>收藏</a><a href=\"###\" onclick=auditresource(\"' + val + '\")>审核</a>';
                }
                // 编辑列
                function checktitle(val) {
                    if (val.indexOf("样本") > 0)
                        return '<span style="color:red;">' + val + '</span>';
                    else
                        return val;
                }
                // 编辑列
                function setimg(val) {
                    var defaulturl = "/pageimage/icon_files_mp3.png";
                    if (val == "视频课例")
                        defaulturl = "/pageimage/icon/spkl1.gif";
                    else if (val == "专题研讨")
                        defaulturl = "/pageimage/icon/ztyt1.gif";
                    else if (val == "教育片段")
                        defaulturl = "/pageimage/icon/jypd1.gif";
                    else if (val == "课例字幕")
                        defaulturl = "/pageimage/icon/klzm1.gif";
                    else if (val == "课例视频")
                        defaulturl = "/pageimage/icon/klsp1.gif";
                    else if (val == "师生电脑作品")
                        defaulturl = "/pageimage/icon/dnzp1.gif";
                    else if (val == "媒体素材")
                        defaulturl = "/pageimage/icon/mtsc1..gif";
                    else if (val == "课件")
                        defaulturl = "/pageimage/icon/kejian1.gif";
                    else if (val == "教案")
                        defaulturl = "/pageimage/icon/jiaoan1.gif";
                    else if (val == "试题")
                        defaulturl = "/pageimage/icon/shiti1.gif";
                       
                    return "<img src='" + defaulturl + "' border='0'>";
                }
                //加载数据
                store.load({ params: { start: 0, limit: 25} });

                // 创建grid对象
                var grid = new Ext.grid.GridPanel({
                    store: store,
                    columns: [
                                { header: "  ", 20, sortable: false, renderer: setimg, dataIndex: 'restype' },
                                { id: 'title', header: "标题", 250, sortable: true, dataIndex: 'title' },
                                { header: "学科", 50, sortable: true, dataIndex: 'subject' },
                                { header: "年级", 50, sortable: true, dataIndex: 'context' },
                                { header: "类型", 50, sortable: true, dataIndex: 'restype' },
                                { header: "执教者", 100, sortable: true, dataIndex: 'tename' },
                                { header: "执教者学校", 200, sortable: true, dataIndex: 'teschool' },
                                { header: "发布时间", 100, sortable: true, dataIndex: 'pubtime' },
                                { header: "点评次数", 50, sortable: true, dataIndex: 'discusnum' },
                                { header: "浏览次数", 50, sortable: true, dataIndex: 'clicknum' },
                                { header: "操作", 120, sortable: false, dataIndex: 'oper' }
                           ],
                    stripeRows: true,
                    autoExpandColumn: '标题',
                    height: 500,
                    1000,
                    viewConfig: {
                        forceFit: true

                    },
                    title: '搜索结果列表',
                    bbar: pagingBar

                });
               
               
               
                grid.render('resourcetable');

            });
            function newwindow(val) {
                var url = "/active/CourseInfo.aspx?code="
                window.open(url + val)
            }   

  • 相关阅读:
    delphi xe10.4新功能介绍
    python tornado 增加数据库连接池
    sql server 自增型字段 在有数据的情况下 修改 标识种子
    c++定时重启某个windows程序
    mssql server 查看作业中执行了哪些脚本
    mssql server 13位时间戳互转
    delphi 13位时间戳互转
    博客开通啦
    java获取当前应用的运行信息(内存,线程,运行时间,状态等)
    java使用websocket,并且获取HttpSession,源码分析
  • 原文地址:https://www.cnblogs.com/neverlost/p/1652050.html
Copyright © 2020-2023  润新知