Pergunta

Hello i want to know how to let the user confirm before deleting Item on Grid Panel so if the user clicked no should stop deleting if yes will fire the ajaxevent. this is my code but it dose not work .

<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>

and this is the 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>

Sorry for my bad English

Foi útil?

Solução

I am not sure suitable for you as u using older version,I generaly doing that like this; 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>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top