1
要求: 我實現了一個函數,該函數通過根據值從我的網格上按下一個按鈕來刪除行。我的要求是,從網格中刪除狀態爲「Verwerkt」,「Ter Fiattering」,「Al verwerkt」的行,並在代碼隱藏中添加一個方法,該方法也會從數據庫中刪除記錄。Ext.NET更改爲網格面板不需要的回滾
問題: 這些行從網格中刪除,但它們在一秒/兩秒後回傳。真奇怪。我收到了有關warningondirrty的警告,但我通過在商店中關閉該消息來取消該消息(WarningOnDirty = false)。幫助:)
的GridPanel:
<ext:Panel runat="server" ID="panel" Height="0">
<TopBar>
<ext:Toolbar runat="server">
<Items>
<ext:Button ID="btnHaalBatch" runat="server" Text="GBA synchroniseren" OnDirectClick="btnHaalBatch_Clicked" Icon="Add"> </ext:Button>
<ext:Button ID="btnVerwerkNAW" runat="server" Text="Verwerk" OnDirectClick="btnVerwerkNAW_Clicked" Icon="Tick">
<%--<DirectEvents>
<Click OnEvent="Wait"/>
</DirectEvents>--%>
</ext:Button>
<ext:ProgressBar ID="Progress1" runat="server" Width="300" Text="Initializing..." Hidden="true" />
<ext:Button ID="btnClearSelection" runat="server" Text="Mutatie(s) legen" Icon="Delete" OnDirectClick="btnClearSelection_Clicked">
<Listeners>
<Click Handler="MutatieLegen(#{grid});" />
</Listeners>
</ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
</ext:Panel>
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<!-- Simple Array Grid -->
<ext:GridPanel ID="grid" runat="server" Title="Wijzigingen" AutoWidth="true" AutoHeight="true" Padding="4" StripeRows="true" Draggable="false" Selectable="true" Icon="Application">
<Store>
<ext:Store ID="Store1" runat="server" WarningOnDirty="false">
<Reader>
<ext:ArrayReader>
<Fields>
<ext:RecordField Name="persoonID" Mapping="PersoonsId" />
<ext:RecordField Name="anummer" Mapping="Anummer" />
<ext:RecordField Name="bSNpersoon" Mapping="BSNpersoon" />
<ext:RecordField Name="type" Mapping="TypeWijziging" />
<ext:RecordField Name="datum" Mapping="DatumBinnenhalen" />
<ext:RecordField Name="omschrijving" Mapping="Omschrijving" />
<ext:RecordField Name="foutmelding" Mapping="Foutmelding" />
</Fields>
</ext:ArrayReader>
</Reader>
</ext:Store>
</Store>
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:RowNumbererColumn />
<ext:Column DataIndex="persoonID" Header="Relatie nr." Width="100">
</ext:Column>
<ext:Column DataIndex="anummer" Header="A-nummer" Width="150">
</ext:Column>
<ext:Column DataIndex="bSNpersoon" Header="BSN" Width="150">
</ext:Column>
<ext:Column DataIndex="type" Header="Type wijziging" Width="150">
</ext:Column>
<ext:Column DataIndex="datum" Header="Datum synchroniseren" Width="200">
</ext:Column>
<ext:Column ColumnID="columnStatus" DataIndex="omschrijving" Header="Status" Width="130">
<Renderer Handler="return imgRenderer(value);" />
</ext:Column>
<ext:Column DataIndex="foutmelding" Header="Reden" Width="350">
</ext:Column>
</Columns>
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="false" />
</SelectionModel>
</ext:GridPanel>
功能JavaScript客戶端刪除行:後面
function MutatieLegen(grid) {
var i = 0;
//var store = Ext.getCmp("grid").getStore();
if (grid.store.getCount() > 0) {
for (i = grid.store.getCount() - 1; i >= 0; i--) {
var status = grid.store.getAt(i).data["omschrijving"];
if (status == "Verwerkt" || status == "Ter Fiattering" || status == "Al verwerkt") {
grid.store.removeAt(i);
}
}
}
代碼:
protected void btnClearSelection_Clicked(Object sender, DirectEventArgs e)
{
// Code behind logic. call sql to delete rows where status == Verwerkt or Ter Fiattering or Al verwerkt
}
就是這樣! *拍拍自己的臉*我很遺憾地看到所有其他的東西,我錯過了101的東西。 – Danny 2012-03-06 08:35:02