Toolkit 1.0 (Ext.Net Namespace) Remote Grouping with HttpProxy
New Community Forums available at http://forums.ext.net
 

Coolite Forums

Welcome Guest ( Login | Register )
 
Toolkit 1.0 (Ext.Net Namespace) Remote...
Subscribe
Last Login: 6/25/2010 5:59:48 AM
Posts: 26,
Posted 6/22/2010 9:32:36 AM

Group: Coolite Early Adopter
Hi all,

I'm just doing some work looking at migrating to the 1.0 toolkit, and have hit a problem. I'd previously implemented remote grouping in a grid panel using an httpproxy. To do this I used a BaseParam of groupBy, which passed the group parameter to my asp.net webservice (asmx).

Having just done some migration testing, it appears that this parameter is no longer populated. Has this changed?

Thanks

Matt
Last Login: 6/25/2010 5:59:48 AM
Posts: 26,
Posted 6/24/2010 4:12:16 AM

Group: Coolite Early Adopter
No ideas?!
Last Login: 7/8/2010 1:50:34 AM
Posts: 4,722,
Posted 6/24/2010 11:59:20 AM

Group: Core Development Team
Hi,

Can you post some code demonstrating the issue?

--
Geoffrey McGill
Coolite Inc.
Development Team
Skype : geoffrey.mcgill
Forum Guidelines | Coolite Examples | Coolite API Docs | ExtJS API Docs | Twitter
Last Login: 6/25/2010 5:59:48 AM
Posts: 26,
Posted 6/25/2010 5:06:09 AM

Group: Coolite Early Adopter

Hi, thanks for the response.

Note: Halfway through writing this post I worked out the solution!! I'll post the code below anyway, with my solution at the end!!

I've just knocked together this Quick example:

This is my markup:


<ext:Store runat="server" ID="store" RemoteGroup="true" RemotePaging="true" RemoteSort="true">
   <Proxy>
    <ext:HttpProxy Json="true" Method="POST" Url="TestService.asmx/GetData2">
    </ext:HttpProxy>
   </Proxy>
   <Reader>
    <ext:JsonReader Root="d.Data" IDProperty="Value" TotalProperty="d.TotalRecords">
     <Fields>
      <ext:RecordField Name="GroupItem" Mapping="GroupItem" />
      <ext:RecordField Name="Name" Mapping="Name" />
      <ext:RecordField Name="Value" Mapping="Value" />
      <ext:RecordField Name="TestDate" Mapping="TestDate" Type="Date" />
     </Fields>
    </ext:JsonReader>
   </Reader>
   <BaseParams>
    <ext:Parameter Name="start" Value="0"></ext:Parameter>
    <ext:Parameter Name="limit" Value="10">
    </ext:Parameter>
    <ext:Parameter Name="sort" Value="">
    </ext:Parameter>
    <ext:Parameter Name="dir" Value="">
    </ext:Parameter>
    <ext:Parameter Name="filters" Value="#{grid}.getFilterPlugin().buildQuery(#{grid}.getFilterPlugin().getFilterData())"
     Mode="Raw" Encode="true">
    </ext:Parameter>
    <ext:Parameter Name="groupBy" Value="">
    </ext:Parameter>
   </BaseParams>
   <Listeners>
    <LoadException Handler="var e = e || {message: response.responseText}; alert('Load failed: ' + e.message);" />
    <SaveException Handler="alert('save failed');" />
    <CommitDone Handler="alert('commit success');" />
    <CommitFailed Handler="alert('Commit failedReason: '+msg)" />
   </Listeners>
  </ext:Store>
  
  <ext:GridPanel runat="server" ID="grid" StoreID="store" Height="400">
   <ColumnModel ID="ColumnModel1" runat="server" IDMode="Inherit">
    <Columns>
     <ext:Column ColumnID="GroupItem" DataIndex="GroupItem" Header="GroupItem">
     </ext:Column>
     <ext:Column ColumnID="Value" DataIndex="Value" Header="Value">
     </ext:Column>
     <ext:Column ColumnID="Name" DataIndex="Name" Header="Name">
     </ext:Column>
     <ext:DateColumn ColumnID="TestDate" DataIndex="TestDate" Header="TestDate" Format="d/m/y">
     
     </ext:DateColumn>
    </Columns>
   </ColumnModel>
   <BottomBar>
    <ext:PagingToolbar runat="server" PageSize="10" PageIndex="1">
    </ext:PagingToolbar>
   </BottomBar>
   <View>
    <ext:GroupingView runat="server" ForceFit="true" HideGroupedColumn="false" StartCollapsed="true"
    EnableGrouping="true" EnableGroupingMenu="true"></ext:GroupingView>
   </View>
   <Plugins>
    <ext:GridFilters runat="server" ParamPrefix="filter">
     <Filters>
      <ext:StringFilter DataIndex="GroupItem" />
      <ext:NumericFilter DataIndex="Value" />
      <ext:StringFilter DataIndex="Name" />
     </Filters>
    </ext:GridFilters>
   </Plugins>
  </ext:GridPanel>


This is my webmethod (kind of):


[WebMethod(EnableSession = true)]
  [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
  public SmartGridResults<DataItem> GetData2(int start, int limit,
   string sort, string dir,
   string filters, string groupBy)
  {
   //do some stuff
   // return data;
  }



In 0.8, if I choose group by this column or if I set a GroupField on the store the groupBy parameter is populated when the webmethod is hit. In 1.0 The groupBy parameter isn't populated.

So, my solution was to populate the groupBy parameter myself:


<ext:Parameter Name="groupBy" Value="#{store}.groupField" Mode="Raw"></ext:Parameter>


Thanks anyway!!! I am getting another error relating to the GridFilter plugin buildquery or getFilterData method always formatting the date in month/day/year, which causes server methods to fail as it cant convert the date - but perhaps thats for another post!!)

Thanks

Matt

« Prev Topic | Next Topic »
Reading This Topic
Active Users: 0 ( 0 guests, 0 members, 0 anonymous members )
No members currently viewing this topic.
All times are GMT -5:00, Time now is 10:56pm