[CLOSED] Data Source as static web method

  1. #1

    [CLOSED] Data Source as static web method

    Hi,

    I want to insert a results grid in a page with search parameters.
    Now I want to obtain it without page reload.
    My idea is a "ProxyMethod" for store that obtain data from a static WebMethod.

    When table data is loading or reloading the store call the static web method [with serch parameters] that returns data [an xml string or an json object in example] and render it.

    It is possible?
    Thank's marc.
  2. #2

    RE: [CLOSED] Data Source as static web method

    Hi Marc,

    The Store can't be binding from static method on page because in the static method the store is inaccessible.
    You can bind Store in Page during AjaxEvent by calling DataBind. Also you can use WebService for binding Store (all cases represented by examples in Example Explorer)

    I am not sure that I understood all details of your request. Do you want create grid dynamically or the grid is presented and you should bind various data? Unfortunately dynamic grid on server-side is impossible now.

    May be you have some mock-up code which can clarify your request fully.

  3. #3

    RE: [CLOSED] Data Source as static web method

    Hi Vladimir,
    thank's for reply.

    The Store can't be binding from static method on page because in the static method the store is inaccessible.

    ...mmm... I don't want acces to store, I want return to store the data [as a webservice], I think a same strategy as Ajax Method Loader in Tree Panel [https://examples1.ext.net/#/TreePane...ethod_Loader/]

    You can bind Store in Page during AjaxEvent by calling DataBind

    ...mmm... ineresting. How to find the example?

    Also you can use WebService for binding Store

    Yes, now I use this strategy but, how to send user parameters to web service? In example the user insert a search key in a text box, click a fiand button and so grid panel refresh the data.

    If is possible work with a single static method in page this use a code more compact and without webservices, sure I preferred this.

    marc.
  4. #4

    RE: [CLOSED] Data Source as static web method

    1. You can't return data object from the page to store. Only DataBinding allowed

    2. Return data during AjaxEvent from the page is very simple. Just set data to DataSource and call DataBind for store
    For example https://examples1.ext.net/#/GridPane...rayWithPaging/

    3. The web service method can has arguments so any parameters from request will be mapped to the args
    For example, BaseParams of Store will be mapped to the webservice args.

    Store

    <ext:Store runat="server" ID="Store1" AutoLoad="true" RemoteSort="true">
        <Proxy>
            <ext:HttpProxy runat="server" Method="POST" Url="../Shared/PlantService.asmx/PlantsPaging" />
        </Proxy>
        <Reader>
            <ext:XmlReader Record="Plant" TotalRecords="TotalRecords">
                <Fields>
                    <ext:RecordField Name="Common" Type="String" />
                    <ext:RecordField Name="Botanical" Type="String" />
                    <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>
        <BaseParams>
            <ext:Parameter Name="start" Value="0" Mode="Raw" />
            <ext:Parameter Name="limit" Value="10" Mode="Raw" />
            <ext:Parameter Name="sort" Value="" />
            <ext:Parameter Name="dir" Value="" />
            <ext:Parameter Name="filter" Value="#{TextField1}.getValue()" Mode="Raw" />
        </BaseParams>
        <SortInfo Field="Common" Direction="ASC" />
    </ext:Store>
    WebService method

    [WebMethod]
    public Paging<Plant> PlantsPaging(int start, int limit, string sort, string dir, string filter)
    {
    ....
    }
  5. #5

    RE: [CLOSED] Data Source as static web method

    Hi Vladimir,
    thank's very mutch.

    1. You can't return data object from the page to store. Only DataBinding allowed

    I don't understand why is possible call a webservice that return xml and not a webmethod that return xml....
    But this is not a big problem I use web services.

    3. The web service method can has arguments so any parameters from request will be mapped to the args

    Yes, in effect I tested BaseParams, ExtraParams, Header.Params but...

    <ext:Parameter Name="filter" Value="#{TextField1}.getValue()" Mode="Raw" />


    Mode="Raw"!!!!
    I'm not tested it!

    Thank's a lot!
    marc.



  6. #6

    RE: [CLOSED] Data Source as static web method

    Hi Vladimir,

    The base params work really good, how to set post Solved?

    marc.
  7. #7

    RE: [CLOSED] Data Source as static web method

    Hi Marc,

    Thnaks for the confirmation.
    Don't worry about it, I'll mark it as CLOSED*

Similar Threads

  1. Replies: 13
    Last Post: May 16, 2011, 1:26 PM
  2. [CLOSED] Global Static variables usage in DirectEvents Method
    By ogokgol in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 04, 2011, 2:35 PM
  3. combobox data source
    By studentdev in forum 1.x Help
    Replies: 1
    Last Post: Feb 05, 2010, 5:50 AM
  4. Handle exception and static method
    By Yannis in forum 1.x Help
    Replies: 4
    Last Post: Dec 18, 2009, 11:45 AM
  5. Replies: 10
    Last Post: Nov 20, 2008, 3:17 PM

Posting Permissions