Hi,
WebService (Plant class see in source code of
https://examples1.ext.net/#/Form/Com...Custom_Search/)
[WebMethod]
public Paging<Plant> PlantsPaging(int start, int limit, string sort, string dir, string filter)
{
List<Plant> plants = Plant.TestData;
if (!string.IsNullOrEmpty(filter) && filter != "*")
{
plants.RemoveAll(plant => !plant.Common.ToLower().Contains(filter.ToLower()));
}
if (!string.IsNullOrEmpty(sort))
{
plants.Sort(delegate(Plant x, Plant y)
{
object a;
object b;
int direction = dir == "DESC" ? -1 : 1;
a = x.GetType().GetProperty(sort).GetValue(x,null);
b = y.GetType().GetProperty(sort).GetValue(y, null);
return CaseInsensitiveComparer.Default.Compare(a, b) * direction;
});
}
if ((start + limit) > plants.Count)
{
limit = plants.Count - start;
}
List<Plant> rangePlants = (start < 0 || limit < 0) ? plants : plants.GetRange(start, limit);
return new Paging<Plant>(rangePlants, plants.Count);
}
Store to read data from web service
<ext:Store ID="Store1" runat="server" RemoteSort="true">
<Proxy>
<ext:HttpProxy Method="GET" Url="../../Shared/PlantService.asmx/PlantsPaging" />
</Proxy>
<AutoLoadParams>
<ext:Parameter Name="start" Value="={0}" />
<ext:Parameter Name="limit" Value="={5}" />
</AutoLoadParams>
<BaseParams>
<ext:Parameter Name="filter" Value="" Mode="Value"></ext:Parameter>
</BaseParams>
<Reader>
<ext:XmlReader Record="Plant" TotalRecords="TotalRecords" >
<Fields>
<ext:RecordField Name="Common" />
<ext:RecordField Name="Botanical" />
<ext:RecordField Name="Light" />
<ext:RecordField Name="Price" Type="Float" />
<ext:RecordField Name="Availability" Type="Date" />
<ext:RecordField Name="Indoor" Type="Boolean" />
</Fields>
</ext:XmlReader>
</Reader>
<SortInfo Field="Common" Direction="ASC" />
</ext:Store>