你好我想知道在删除Grid Panel上的Item之前如何让用户确认,所以如果用户点击no则应该停止删除if yes将触发ajaxevent。 这是我的代码但不起作用。
<script>
var showResult = function (btn) {
var bsit = false;
Ext.Msg.confirm('Delete!', 'Are You Sure?', function (btn, text) {
if (btn == 'yes') {
bsit = true;
} else {
bsit = false;
}
});
retrn bsit;
};
</script>
这是gridpanel
<ext:GridPanel Title="Emplyees" AnimCollapse="true" ID="GridPanel1" runat="server" Width="700"
StoreID="grvContractors">
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column ColumnID="Name" Header="Name" Width="150" Sortable="true"
DataIndex="Contractor_Name">
</ext:Column>
<ext:Column ColumnID="Tel" Header="Phone" DataIndex="Tel" Width="150" Sortable="true">
</ext:Column>
<ext:CommandColumn Width="60">
<Commands>
<ext:GridCommand Icon="Delete" CommandName="Delete" Text="Delete" >
</ext:GridCommand>
</Commands>
</ext:CommandColumn>
</Columns>
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel1" runat="server" />
</SelectionModel>
<Listeners>
<Command Handler="showResult" />
</Listeners>
<AjaxEvents>
<Command OnEvent="DeleteVote" >
<ExtraParams>
<ext:Parameter Name="Contractor_ID" Value="record.data.Contractor_ID" Mode="Raw" />
</ExtraParams>
</Command>
</AjaxEvents>
</ext:GridPanel>
抱歉我的英文不好
答案 0 :(得分:0)
我不太适合你使用旧版本,我通常这样做; V.2.2
<ext:CommandColumn runat="server">
<Commands>
<ext:GridCommand Icon="Delete" CommandName="delete" >
</ext:GridCommand>
</Commands>
<Listeners >
<Command Handler=" if(showResult()){App.direct.Test(); } else{ } "></Command>
</Listeners>
</ext:CommandColumn>