Coolite GridPanel中多个button的事件调用方法:
时间:2010-09-15 来源:Oliver_zh
function DeleteInfo(command, BelongFenjuId, FileNameD,FileNameO,typeName) {
if (command != "Down") {
Ext.Msg.confirm('提示', '确定删除吗?', function(btn) {
if (btn == 'yes') {
Coolite.AjaxMethods.DeleteRecord(BelongFenjuId, typeName);
}
else {
return;
}
});
}
else {
Ext.Msg.confirm('提示', '确定下载吗?', function(btn) {
if (btn == 'yes') {
Coolite.AjaxMethods.DownFile(FileNameD, FileNameO);
}
else {
return;
}
});
}
}
<ext:Store ID="extStore" runat="server" OnRefreshData="extStore_RefreshData">
<AutoLoadParams>
<ext:Parameter Name="start" Value="0" Mode="Raw" />
<ext:Parameter Name="limit" Value="10" Mode="Raw" />
</AutoLoadParams>
<Proxy>
<ext:DataSourceProxy AutoDataBind="true" />
</Proxy>
<Reader>
<ext:JsonReader ReaderID="Id" Root="data" TotalProperty="totalCount">
<Fields>
<ext:RecordField Name="Id" />
<ext:RecordField Name="ProtocolN" />
<ext:RecordField Name="FileNameO" />
<ext:RecordField Name="FileNameD" />
<ext:RecordField Name="Modify" />
<ext:RecordField Name="ModifyDate" Type="Date" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
<ext:GridPanel ID="GPT1" runat="server" Frame="true" StoreID="extStore" BodyBorder="false"
AutoScroll="true" Height="450" Width="720" AutoExpandColumn="FileNameO">
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column DataIndex="ProtocolN" Header="名称" Width="100" />
<ext:Column DataIndex="Modify" Header="上传人" Width="100" />
<ext:Column DataIndex="FileNameO" Header="文件名" Width="100" />
<ext:CommandColumn Width="110">
<Commands>
<ext:GridCommand Icon="Delete" CommandName="Delete" Text="删除" />
<ext:CommandSeparator />
<ext:GridCommand CommandName="Down" Text="下载" />
</Commands>
</ext:CommandColumn>
</Columns>
</ColumnModel>
<LoadMask ShowMask="true" />
<SelectionModel>
<ext:RowSelectionModel SingleSelect="true">
</ext:RowSelectionModel>
</SelectionModel>
<BottomBar>
<ext:PagingToolbar ID="NewHousePagingToolBar" runat="server" PageSize="10" StoreID="extStore"
DisplayInfo="true" DisplayMsg="当前记录 {0} -- {1} 条 共 {2} 条记录" EmptyMsg="没有记录 ">
</ext:PagingToolbar>
</BottomBar>
<Listeners>
<Command Handler="DeleteInfo(command, record.data.Id,record.data.FileNameD,record.data.FileNameO,'User')" />
</Listeners>
</ext:GridPanel>
if (command != "Down") {
Ext.Msg.confirm('提示', '确定删除吗?', function(btn) {
if (btn == 'yes') {
Coolite.AjaxMethods.DeleteRecord(BelongFenjuId, typeName);
}
else {
return;
}
});
}
else {
Ext.Msg.confirm('提示', '确定下载吗?', function(btn) {
if (btn == 'yes') {
Coolite.AjaxMethods.DownFile(FileNameD, FileNameO);
}
else {
return;
}
});
}
}
<ext:Store ID="extStore" runat="server" OnRefreshData="extStore_RefreshData">
<AutoLoadParams>
<ext:Parameter Name="start" Value="0" Mode="Raw" />
<ext:Parameter Name="limit" Value="10" Mode="Raw" />
</AutoLoadParams>
<Proxy>
<ext:DataSourceProxy AutoDataBind="true" />
</Proxy>
<Reader>
<ext:JsonReader ReaderID="Id" Root="data" TotalProperty="totalCount">
<Fields>
<ext:RecordField Name="Id" />
<ext:RecordField Name="ProtocolN" />
<ext:RecordField Name="FileNameO" />
<ext:RecordField Name="FileNameD" />
<ext:RecordField Name="Modify" />
<ext:RecordField Name="ModifyDate" Type="Date" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
<ext:GridPanel ID="GPT1" runat="server" Frame="true" StoreID="extStore" BodyBorder="false"
AutoScroll="true" Height="450" Width="720" AutoExpandColumn="FileNameO">
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column DataIndex="ProtocolN" Header="名称" Width="100" />
<ext:Column DataIndex="Modify" Header="上传人" Width="100" />
<ext:Column DataIndex="FileNameO" Header="文件名" Width="100" />
<ext:CommandColumn Width="110">
<Commands>
<ext:GridCommand Icon="Delete" CommandName="Delete" Text="删除" />
<ext:CommandSeparator />
<ext:GridCommand CommandName="Down" Text="下载" />
</Commands>
</ext:CommandColumn>
</Columns>
</ColumnModel>
<LoadMask ShowMask="true" />
<SelectionModel>
<ext:RowSelectionModel SingleSelect="true">
</ext:RowSelectionModel>
</SelectionModel>
<BottomBar>
<ext:PagingToolbar ID="NewHousePagingToolBar" runat="server" PageSize="10" StoreID="extStore"
DisplayInfo="true" DisplayMsg="当前记录 {0} -- {1} 条 共 {2} 条记录" EmptyMsg="没有记录 ">
</ext:PagingToolbar>
</BottomBar>
<Listeners>
<Command Handler="DeleteInfo(command, record.data.Id,record.data.FileNameD,record.data.FileNameO,'User')" />
</Listeners>
</ext:GridPanel>
相关阅读 更多 +