Jan 22, 2011, 11:13 AM
GridPanel : Delete Row from button without Select the row firstly
Hiii,
I have a GridPanel that contains a button "delete" for each row, I want when the button clicks the line would be completely removed without selecting to remove :(
without going through the instruction "#{GridTransaction}.deleteSelected();"
I have a GridPanel that contains a button "delete" for each row, I want when the button clicks the line would be completely removed without selecting to remove :(
without going through the instruction "#{GridTransaction}.deleteSelected();"
<script type="text/javascript">
var updateRecord = function (form) {
if (form.record == null) {
return;
}
form.getForm().updateRecord(form.record);
};
var addRecord = function (form, grid) {
grid.insertRecord(0, form.getForm().getFieldValues(false, "dataIndex"));
};
</script>
<ext:Store
ID="StoreGridTransaction"
runat="server"
OnBeforeStoreChanged="HandleChanges"
SkipIdForNewRecords="false"
RefreshAfterSaving="Always"
OnRefreshData="MyData_Refresh">
<Reader>
<ext:JsonReader IDProperty="idTransaction">
<Fields>
<ext:RecordField Name="idTransaction" />
<ext:RecordField Name="matriculeCamion" />
<ext:RecordField Name="libelleTiers" />
<ext:RecordField Name="nomPrenom" />
<ext:RecordField Name="libProduit" />
<ext:RecordField Name="poidsTare" Type="Float" />
<ext:RecordField Name="DateDepart" Type="Date" />
</Fields>
</ext:JsonReader>
</Reader>
<SortInfo Field="idTransaction" Direction="ASC" />
</ext:Store>
<ext:GridPanel
ID="GridTransaction"
runat="server"
Title="Entrée / Sortie Camion"
StoreID="StoreGridTransaction"
Height="400" Width="800" TrackMouseOver="True">
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column ColumnID="ID" Header="ID" Width="50" DataIndex="idTransaction" />
<ext:Column Header="Camion" Width="100" DataIndex="matriculeCamion">
</ext:Column>
<ext:Column Header="Client" Width="100" DataIndex="libelleTiers">
</ext:Column>
<ext:Column Header="Chauffeur" Width="100" DataIndex="nomPrenom">
</ext:Column>
<ext:Column Header="Produit" Width="100" DataIndex="libProduit" />
<ext:Column Header="Poids Tare" Width="80" DataIndex="poidsTare" />
<ext:Column Header="DateDepart" Width="100" DataIndex="DateDepart" />
<ext:CommandColumn Width="110" Header="Action">
<Commands>
<ext:GridCommand Icon="CarStop" CommandName="Delete" Text="Sortie Camion" />
</Commands>
</ext:CommandColumn>
</Columns>
</ColumnModel>
<Listeners>
<Command Handler="#{GridTransaction}.deleteSelected();#{GridTransaction}.save();" />
</Listeners>
<LoadMask ShowMask="True"></LoadMask>
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true">
<Listeners>
<RowSelect Handler="#{EntreeForm}.record = record;" />
</Listeners>
</ext:RowSelectionModel>
</SelectionModel>
<LoadMask ShowMask="true" />
<TopBar>
<ext:Toolbar ID="Toolbar1" runat="server">
<Items>
<ext:Button ID="Button6"
runat="server"
Text="Auto Save"
EnableToggle="true"
Pressed="true"
ToolTip="When enabled, Store will execute Ajax requests as soon as a Record becomes dirty." Visible="False">
<Listeners>
<Toggle Handler="#{StoreGridTransaction}.autoSave = pressed;#{StoreGridTransaction}.useIdConfirmation = !pressed;#{UseConfirmation}.setValue(!pressed);" />
</Listeners>
</ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
<BottomBar>
<ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="10">
<Items>
<ext:Label ID="Label1" runat="server" Text="Page size:" />
<ext:ToolbarSpacer ID="ToolbarSpacer1" runat="server" Width="10" />
<ext:ComboBox ID="ComboBox2" runat="server" Width="80">
<SelectedItem Value="10"></SelectedItem>
<Items>
<ext:ListItem Text="5" />
<ext:ListItem Text="10" />
<ext:ListItem Text="20" />
<ext:ListItem Text="30" />
</Items>
<SelectedItem Value="10" />
<Listeners>
<Select Handler="#{PagingToolbar1}.pageSize = parseInt(this.getValue()); #{PagingToolbar1}.doLoad();"></Select>
</Listeners>
</ext:ComboBox>
</Items>
</ext:PagingToolbar>
</BottomBar>
</ext:GridPanel>
Thanks
Last edited by zizoovic; Jan 22, 2011 at 11:39 AM.