`

extjs RowExpander

阅读更多

		var expander = new Ext.ux.grid.RowExpander({
			tpl : new Ext.XTemplate('<div class="x-grid-group-title" style="margin-left:10%">'
+ '<table class="displayTable">'
+ '<thead><tr><th>审核单位</th><th>审核人员</th><th>审核时间</th><th>审核状态</th></tr></thead>'
+ '<tpl for="auditHistory"><tr>' + '<td><tpl for="auditCorp">{name}</tpl></td>'
+ '<td><tpl for="auditUser">{cnName}</tpl></td> '
+ '<td>{auditDate:this.getAuditDate}</td><td>{status:this.getStauts}</td>' + '</tr>'
+ '</tpl>' + '</table>' + '<table class="displayTable">' + '<thead>'
+ '<tr><th>收费项目</th><th>收费金额</th></tr>' + '</thead>' + '<tpl for="details"><tr>'
+ '<td><tpl for="feeType">{name}</tpl></td>' + '<td align="right">{chargesMoney}</td> '
+ '</tr>' + '</tpl>' + '</table>' + '</div>', {
									getAuditDate : function(d) {
										if (d)
											return Date.parseDate(d, "Y-m-d\\TH:i:s").format("Y-m-d H:i:s");
										return "";
									},
									getStauts : function(val) {
										switch (val) {
											case 0 :
												return "同意";
											case 1 :
												return "退回";
											default :
												return "";
										}

									}
								}),
						lazyRender : true,
						enableCaching : false,
						toggleRow : function(row) {

							if (typeof row == 'number') {
								row = this.grid.view.getRow(row);
							}
							if (!Ext.fly(row).hasClass('x-grid3-row-collapsed')) {
								this.collapseRow(row);
								return;
							}
							var store = this.grid.store;
							var record = this.grid.store.getAt(row.rowIndex);
							var _this = this;

							var mark = new Ext.LoadMask(Ext.getBody(), {
										msg : 'Loading data...',
										removeMask : true
									});
							mark.show();
							Ext.Ajax.request({
										url : './notecollection!show.html',
										params : {
											'id' : record.id
										},
										method : 'POST',
										callback : function(option, success, response) {
											var rt = Ext.util.JSON.decode(response.responseText);
											if (success && rt.success) {
												record.set("details", rt.details);
												record.set("auditHistory", rt.auditHistory);
												_this.expandRow(row.rowIndex);
											} else {
												handgoajax.ajaxError(rt.msg);
											}
											mark.hide();
										}
									});
						}

					});
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics