extjs布局

Ext.namespace("Swfu"); 
Ext.namespace("Swfu.BackMgr.mainview");


GongGao = new Ext.grid.GridPanel({
    id: 'noticeGrid',
    border: false,
    layout: 'fit',
    store: GGstore = new Ext.data.Store({
        url: '/newsinfo.mvc/FindNewsinfoByClassify',
        reader: new Ext.data.JsonReader({
            id: 'noticeReader',
            fields: ["newsid", "newsclassify", "newscontent", "newstitle", "newsdesc", "newsowner", "newstime"]
        })
    }),
    columns: [
        new Ext.grid.RowNumberer({ hidden: true }),
        { header: '标题', width: '110%', autowidth: true, dataIndex: 'newstitle', renderer: function(value) { var xinxi = value.length > 23 ? value.substring(0, 23) + "..." : value; return "<img src='../Content/images/home/news6.gif' width='14px' height='14px'><a href='#'>" + xinxi + "</a>" } },
        { header: '时间', hidden: false, dataIndex: 'newstime', renderer: function(value) { return value.substring(0, 10) } }
    ],
    sm: new Ext.grid.RowSelectionModel({ singleSelect: true }),
    autoHeight: true,
    autoWidth: true,
    hideHeaders: true, 
    loadMask: true
});
GGstore.load({ params: { classify: '最新公告'} });


DongTai = new Ext.grid.GridPanel({
    id: 'dontaiNews',
    border: false,
    store: DTStore = new Ext.data.Store({
        url: '/newsinfo.mvc/FindNewsinfoByClassify',
        reader: new Ext.data.JsonReader({
                id: 'DongtaiReader', 
                fields: ["newsid", "newsclassify", "newscontent", "newstitle", "newsdesc", "newsowner", "newstime"] 
            })
    }),
    columns: [
        new Ext.grid.RowNumberer({ hidden: true }),
        { header: '标题', width: '90%', dataIndex: 'newstitle', renderer: function(value) { var xinxi = value.length > 23 ? value.substring(0, 23) + "..." : value; return "<img src='../Content/images/home/notice4.gif' width='14px' height='14px'><a href='#'>" + xinxi + "</a>" } }, 
        { header: '时间', dataIndex: 'newstime', renderer: function(value) { return value.substring(0, 10) } }],
    sm: new Ext.grid.RowSelectionModel({ singleSelect: true }),
    autoHeight: true,
    autoWidth: true,
    hideHeaders: true, 
    loadMask: true
});
DTStore.load({ params: { classify: '社会动态'} });


DongTai.addListener("rowclick", cellclick); 
function cellclick(grid, rowIndex, e) {
    var selections = this.selModel.getSelections(); 
    var record = selections[0];
    var win = new Ext.Window({
        title: '最新动态--' + record.get('newstitle'),
        width: 900,
        bodyStyle: 'background-color:#FFFFFF',
        height: 500, 
        modal: true,
        autoScroll: true,
        resizable: true,
        maximizable: true,
        minimizable: true, 
        autoDestroy: true,
        html: "<table align='center' width='90%' height='90%'><tr><td  id='tdTitle'>" + record.get('newstitle') + "</td></tr><tr><td valign='top' id='tdContent'><hr />&nbsp;&nbsp;&nbsp;&nbsp;" + record.get('newscontent') + "</td></tr><tr><td id='tdZz'><hr />发布人:" + record.get("newsowner") + " 发布时间:" + record.get("newstime") + "</td></tr></table>"
    });
    win.show()
}


GongGao.addListener("rowclick", cellclick2);
function cellclick2(grid, rowIndex, e) {
    var selections = this.selModel.getSelections();
    var record = selections[0];
    var win = new Ext.Window({
        title: '最新公告--' + record.get('newstitle'),
        width: 900,
        bodyStyle: 'background-color:#FFFFFF', 
        height: 500, modal: true,
        autoScroll: true,
        resizable: true,
        maximizable: true,
        minimizable: true, 
        autoDestroy: true,
        html: "<table align='center' width='90%' height='90%'><tr><td  id='tdTitle'>" + record.get('newstitle') + "</td></tr><tr><td valign='top' id='tdContent'><hr />&nbsp;&nbsp;&nbsp;&nbsp;" + record.get('newscontent') + "</td></tr><tr><td id='tdZz'><hr />发布人:" + record.get("newsowner") + " 发布时间:" + record.get("newstime") + "</td></tr></table>"
    });
    win.show()
}


Swfu.BackMgr.mainview.Welcome = Ext.extend(Ext.TabPanel, {
    initComponent: function() {
        var tools = [{ id: 'close', handler: function(e, target, panel) { panel.ownerCt.remove(panel, true) } }];
        Ext.apply(this, {
            activeTab: 0,
            autoScroll: false,
            tabPosition: 'button',
            layoutOnTabChange: true,
            items: [
            {
                layout: 'column',
                items: [
                { 
                    columnWidth: .50,
                    style: 'padding:10 10 10 10',
                    border: false,
                    layout: 'fit',
                    draggable: true,
                    items: [{
                        title: '最新公告',
                        layout: 'column',
                        bodyStyle: 'background-color:#FFFFFF',
                        tools: [{ id: 'refresh', handler: function() { GGstore.reload() } }, { id: 'close', handler: function(e, target, panel) { panel.ownerCt.remove(panel, true) } }],
                        margins: '0',
                        height: 200,
                        frame: true,
                        items: GongGao
                    }]
                },
                {
                    columnWidth: .50,
                    style: 'padding:10 10 10 10',
                    border: false,
                    draggable: true,
                    layout: 'fit',
                    items: [{
                    title: '社会动态',
                    layout: 'column',
                    bodyStyle: 'background-color:#FFFFFF',
                    tools: [{id: 'refresh',handler: function() { DTStore.reload() } },
                        { id: 'close', handler: function(e, target, panel) { panel.ownerCt.remove(panel, true) } }],
                    margins: '0',
                    height: 200,
                    frame: true,
                    items: DongTai}]
                },
                {
                    columnWidth: .25,
                    style: 'padding:5 10 10 10',
                    border: false,
                    draggable: true,
                    items: [{
                        title: '日历',
                        layout: 'form',
                        tools: tools,
                        collapsible: true,
                        margins: '0',
                        height: 200,
                        frame: true,
                        html: '<p align="center"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" height="170"  ><param name="movie" value="../Content/flash/calculator.swf"><param name="quality" value="high"><param name="wmode" value="transparent"><embed src="../Content/flash/calculator.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"  height="170"></embed></object></P>'
                    }]
                },
                {
                    columnWidth: .50,
                    style: 'padding:5 10 10 10',
                    border: false,
                    draggable: true,
                    items: [{ 
                        title: '百度搜索',
                        layout: 'column',
                        tools: tools,
                        margins: '0',
                        collapsible: true,
                        height: 200,
                        frame: true,
                        html: '<p align="center"><br /><br /><img src="../Content/images/head.png" width="350px" > <br /><br /><br /><FORM name=f action=http://www.baidu.com/s>' + '<INPUT οnmοuseοver=this.focus() style="MARGIN-TOP: 1px; PADDING-LEFT: 1px; FONT-SIZE: 12px; PADDING-TOP: 1px; FONT-FAMILY: verdana,arial; HEIGHT:"  οnfοcus=this.select() maxLength=200 size=50 name=word>&nbsp;<INPUT style="FONT-SIZE: 12px; MARGIN-BOTTOM: -1px; WIDTH: 6em; PADDING-TOP: 2px; HEIGHT: 2em" type=submit value=百度一下>  </FORM></p>'
                    }]
                },
                { 
                    columnWidth: .25,
                    style: 'padding:5 10 10 10',
                    border: false, 
                    draggable: true,
                    items: [{ 
                        title: '时钟',
                        layout: 'column',
                        tools: tools,
                        margins: '0',
                        height: 200,
                        collapsible: true,
                        frame: true,
                        html: '<p align="center"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"  style="height: 160px; "><param name="movie" value="../Content/flash/clock144.swf"><param name="quality" value="high"><param name="wmode" value="transparent"><embed src="../Content/flash/clock144.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" height="160"></embed></object></P>'
                    }]
                }]
            }]
        });
        Swfu.BackMgr.mainview.Welcome.superclass.initComponent.apply(this, arguments)
    } 
});
Ext.reg('welcome',Swfu.BackMgr.mainview.Welcome);
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值