{title}
', '<pd><img src="%7Bimage%7D">', '<pd>作者:{authorf}', '<pd>日期:{adddatef:date("Y年m月d日 H时i分s秒")}', '<pd>来自:{ip} <brddd>--', '<p>{content}</p> <br><br>' ) }); var cm = new Ext.grid.ColumnModel([ expander, { id: 'id', header: '编号', dataIndex: 'id', type: 'int', width: 30, hidden: true },{ id: 'title', header: '标题', dataIndex: 'title', type: 'string', width: 80 },{ id: 'author', header: '作者', dataIndex: 'author', type: 'string', width: 80 },{ id: 'adddate', header: '留言时间', dataIndex: 'adddate', type: 'date', renderer: Ext.util.Format.dateRenderer('Y年m月d日 H时i分s秒'), width: 80 }]); cm.defaultSortable = true; var proxy = new Ext.data.HttpProxy({url:'list.jsp'}); var reader = new Ext.data.JsonReader({ totalProperty: 'totalProperty', root: 'root' }, MessageRecord); var store = new Ext.data.Store({ proxy: proxy, reader: reader, baseParams: {limit:pageSize} }); store.load({params:{start: 0}}); var postNewMessage1 = new Ext.Button({ text: '发表新留言', tooltip: '发表新留言', cls: 'x-btn-pressed', handler: postMessage }); var postNewMessage2 = new Ext.Button({ text: '发表新留言', tooltip: '发表新留言', cls: 'x-btn-pressed', handler: postMessage }); var viewMessage1 = new Ext.Button({ text: '详细模式', pressed: true, enableToggle: true, tooltip: '切换显示模式', toggleHandler: toggleDetails }); var viewMessage2 = new Ext.Button({ text: '详细模式', pressed: true, enableToggle: true, tooltip: '切换显示模式', toggleHandler: toggleDetails }); var pagingToolbar1 = new Ext.PagingToolbar({ pageSize: pageSize, store: store, displayInfo: true, displayMsg: '显示第 <em>{0}</em> 条到 <em>{1}</em> 条记录,一共 <em>{2}</em> 条', emptyMsg: "没有记录", items: ['-', postNewMessage1, '-', viewMessage1] }); var pagingToolbar2 = new Ext.PagingToolbar({ pageSize: pageSize, store: store, displayInfo: true, displayMsg: '显示第 <em>{0}</em> 条到 <em>{1}</em> 条记录,一共 <em>{2}</em> 条', emptyMsg: "没有记录", items: ['-', postNewMessage2, '-', viewMessage2] }); var grid = new Ext.grid.GridPanel({ autoHeight: true, width: 800, store: store, cm: cm, sm: new Ext.grid.RowSelectionModel({ selectRow: function(index, keepExisting, preventViewNotify) { expander.toggleRow(index); } }), loadMask: true, viewConfig: { forceFit: true }, renderTo: 'content', tbar: pagingToolbar1, bbar: pagingToolbar2, plugins: expander, collapsible: true, animCollapse: false }); store.on('load', function(){ for (var i = 0; i <img id="face" src="http://10.142.247.110:8080/tweb/resources/images/bbsicons/face/em1.gif">' }] }] },{ fieldLabel: '内容', name: 'content', xtype: 'htmleditor', allowBlank: false, enableColors: false, enableAlignments: false } ], buttons: [{ text: '发布', handler: submitForm },{ text: '取消', handler: cancelForm }] }); } if(!win){ win = new Ext.Window({ layout: 'fit', width: 700, height: 450, resizable: true, closeAction: 'hide', title: '发布新留言', items: [formPanel] }); } formPanel.getForm().reset(); win.show(btn.el); } function submitForm() { if (!formPanel.getForm().isValid()) { return; } formPanel.getForm().submit({ success: function(form, action) { if (action.result.success) { store.reload(); Ext.Msg.confirm('信息', '发布成功:' + action.result.msg + '。是否继续添加?', function(btn) { if (btn == 'yes') { formPanel.getForm().reset(); } else { win.hide(); } }); } else { Ext.Msg.alert('错误', '发布失败:' + action.result.msg); } }, failure: function() { Ext.Msg.alert('错误', '发布失败'); } }) } function cancelForm() { win.hide(); } }); </brddd></pd></pd></pd></pd>