<ext:ResourceManager ID="ResourceManagerMain" runat="server" Locale="pl" EnableViewState="false" EnableTheming="false" RethrowAjaxExceptions="true" RemoveViewState="true" />
<ext:Viewport ID="ViewportMainExt" runat="server" Layout="border" >
<Items>
<ext:Panel ID="PanelMain"
runat="server"
Title="Title"
Region="Center"
Split="false"
Header="true"
AutoScroll="true"
Collapsible="false">
<Content>
<ext:BorderLayout>
<Center>
<ext:Panel ID="PanelDicListGrid" runat="server" Title="Lista urządzeń" Collapsible="false" Header="false" Split="true">
<Items>
<ext:FitLayout ID="fl1" runat="server">
<Items>
<ext:GridPanel ID="GridPanelMain" runat="server" SelectionMemory="Enabled" TrackMouseOver="true" EnableViewState="false">
<Store>
<ext:Store ID="StoreMain" runat="server" RemoteSort="true" OnRefreshData="Store1_RefreshData" EnableViewState="false">
<Proxy>
<ext:PageProxy />
</Proxy>
<Reader>
<ext:JsonReader IDProperty="Id">
<Fields>
<ext:RecordField Name="Id" Type="Int" />
<ext:RecordField Name="Nazwa" Type="String" />
<ext:RecordField Name="Model" Type="String" />
<ext:RecordField Name="KodKreskowy" Type="String" />
<ext:RecordField Name="NrSeryjny" Type="String" />
<ext:RecordField Name="NrInwentarzowy" Type="String" />
<ext:RecordField Name="NrPaszportu" Type="String" />
<ext:RecordField Name="Kategoria" Type="String" />
<ext:RecordField Name="Zestaw" Type="Boolean" />
<ext:RecordField Name="ZestawNazwa" Type="String" />
<ext:RecordField Name="Cena" Type="Float" />
<ext:RecordField Name="ServiceDate" Type="Date" />
<ext:RecordField Name="RokProdukcji" Type="Int" />
<ext:RecordField Name="Wycofano" Type="Boolean" />
</Fields>
</ext:JsonReader>
</Reader>
<BaseParams>
<ext:Parameter Name="start" Value="0" Mode="Raw" />
<ext:Parameter Name="limit" Value="100" Mode="Raw" />
<ext:Parameter Name="sort" Value="" />
<ext:Parameter Name="dir" Value="" />
</BaseParams>
<SortInfo Field="Nazwa" Direction="ASC" />
</ext:Store>
</Store>
<ColumnModel ID="ColumnModel1" runat="server" EnableViewState="false">
<Columns>
<ext:NumberColumn Header="Id" DataIndex="Id" Format="0" MenuDisabled="true" />
<ext:Column Header="Nazwa" DataIndex="Nazwa" MenuDisabled="true" />
<ext:Column Header="Typ" DataIndex="Model" MenuDisabled="true" />
<ext:Column Header="Kod Kreskowy" DataIndex="KodKreskowy" MenuDisabled="true" />
<ext:Column Header="Nr. Seryjny" DataIndex="NrSeryjny" MenuDisabled="true" />
<ext:Column Header="Nr. Inwentarzowy" DataIndex="NrInwentarzowy" MenuDisabled="true" />
<ext:Column Header="Nr. Paszportu" DataIndex="NrPaszportu" MenuDisabled="true" />
<ext:Column Header="Kategoria" DataIndex="Kategoria" MenuDisabled="true" />
<ext:BooleanColumn Header="Zestaw" DataIndex="Zestaw" FalseText="" TrueText="Tak" MenuDisabled="true" />
<ext:Column Header="Nazwa zestawu" DataIndex="ZestawNazwa" MenuDisabled="true" />
<ext:NumberColumn Header="Cena" DataIndex="Cena" Format="0.000,00 zł/i" MenuDisabled="true" />
<ext:DateColumn Header="Data serwisu" DataIndex="ServiceDate" Format="dd-MM-yyyy" MenuDisabled="true" />
<ext:NumberColumn Header="Rok Produkcji" DataIndex="RokProdukcji" Format="0" MenuDisabled="true" />
<ext:CheckColumn Header="Wycofano" DataIndex="Wycofano" MenuDisabled="true" />
</Columns>
</ColumnModel>
<SelectionModel>
<ext:CheckboxSelectionModel CheckOnly="false" KeepSelectionOnClick="WithCtrlKey" SingleSelect="false" />
</SelectionModel>
<BottomBar>
<ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="100" DisplayInfo="true" DisplayMsg="Wiersze {0} - {1} z {2}" EmptyMsg="Brak wierszy">
<Plugins>
<ext:SlidingPager />
</Plugins>
</ext:PagingToolbar>
</BottomBar>
<DirectEvents>
<RowDblClick OnEvent="OnRowDblClick_GridPanelMain">
<ExtraParams>
<ext:Parameter Name="grow" Value="this.store.getAt(rowIndex).data['Id']" Mode="Raw" />
</ExtraParams>
<EventMask ShowMask="true" Msg="Proszę poczekać ..." />
</RowDblClick>
</DirectEvents>
<LoadMask ShowMask="true" Msg="Proszę poczekać ..." />
</ext:GridPanel>
</Items>
</ext:FitLayout>
</Items>
</ext:Panel>
</Center>
</ext:BorderLayout>
</Content>
</ext:Panel>
</Items>
</ext:Viewport>
protected void Store1_RefreshData(object sender, StoreRefreshDataEventArgs e)
{
List<object> data = MMEwidencja.BLL.DeviceInfo.GetFullList().Cast<object>().ToList<object>();
//-- start sorting ------------------------------------------------------------
if (!string.IsNullOrEmpty(e.Sort))
{
data.Sort(delegate(object x, object y)
{
object a;
object b;
int direction = e.Dir == Ext.Net.SortDirection.DESC ? -1 : 1;
a = x.GetType().GetProperty(e.Sort).GetValue(x, null);
b = y.GetType().GetProperty(e.Sort).GetValue(y, null);
return CaseInsensitiveComparer.Default.Compare(a, b) * direction;
});
}
//-- end sorting ------------------------------------------------------------
//-- start paging ------------------------------------------------------------
var limit = e.Limit;
if ((e.Start + e.Limit) > data.Count)
{
limit = data.Count - e.Start;
}
List<object> rangeData = (e.Start < 0 || limit < 0) ? data : data.GetRange(e.Start, limit);
//-- end paging ------------------------------------------------------------
//The Total can be set in RefreshData event as below
//or (Store1.Proxy.Proxy as PageProxy).Total in anywhere
//Please pay attention that the Total make a sence only during DirectEvent because
//the Store with PageProxy get/refresh data using ajax request
e.Total = data.Count;
this.GridPanelMain.GetStore().DataSource = rangeData;
}