Example of using a RESTful Store with something other than a GridPanel

  1. #1

    Example of using a RESTful Store with something other than a GridPanel

    I've got a Form hooked up to a Store with a RestAPI setup. I am having a problem getting a button to call the Update method. I keep getting a "Object [object Object] has no method 'update'" error. The initial GET REST method that loads the form works fine.

    Here's are my code snippets
        function updateOrder() {
            alert("updating");
            dsOrder.update();
        }
    
    
    
    
    
    <ext:Store ID="dsOrder" runat="server" AutoLoad="true" SerializationMode="Complex"
        AutoSave="true" Restful="true">
        
        <Proxy>
            <ext:HttpProxy>
                <RestAPI ReadUrl="/Order/Get" 
                UpdateUrl="/Order/Update" CreateUrl="/RestDemo/Create"
                    DestroyUrl="/RestDemo/Destroy" />
            </ext:HttpProxy>
        </Proxy>
        <Reader>
            <ext:JsonReader IDProperty="OrderNumber" Root="data">
                <Fields>
                    <ext:RecordField Name="OrderID"  />
                    <ext:RecordField Name="OrderNumber" />
                    <ext:RecordField Name="UserName" />
                    <ext:RecordField Name="DateCreated" Type="Date" />
                    <ext:RecordField Name="OrderStatusID" />
                    <ext:RecordField Name="Items" IsComplex="true" />
                    <ext:RecordField Name="ShippingAddress">
                        <Convert Fn="convertShippingVals" />
                    </ext:RecordField>
                    <ext:RecordField Name="ShippingMethodID">
                        <Convert Fn="convertShipMethodToText" />
                    </ext:RecordField>
                    <ext:RecordField Name="ShippingMethodText" />
                    <ext:RecordField Name="ShippingAmount" />
                    <ext:RecordField Name="DateShipped" Type="Date">
                        <Convert Fn="formatDateShipped" />
                    </ext:RecordField>
                    <ext:RecordField Name="DateShippedText" />
                    <ext:RecordField Name="EstimatedDelivery" Type="Date" />
                    <ext:RecordField Name="TrackingNumber" />
                    <ext:RecordField Name="FirstName" />
                    <ext:RecordField Name="LastName" />
                    <ext:RecordField Name="Street1" />
                    <ext:RecordField Name="Street2" />
                    <ext:RecordField Name="City" />
                    <ext:RecordField Name="StateOrProvince" />
                    <ext:RecordField Name="Zip" />
                    <ext:RecordField Name="Country" />
                </Fields>
            </ext:JsonReader>
        </Reader>
        <BaseParams>
            <ext:Parameter Name="start" Value="0" Mode="Raw" />
            <ext:Parameter Name="ordernum" Value="#{txtOID}.getValue()" Mode="Raw" />
        </BaseParams>
        <Listeners>
            <Load Handler="OrderDetails.body.unmask(); if(records.length > 0) { fillOrder(records[0])}else { #{OrderCommonInformation}.form.reset(); #{ShippingInformationForm}.form.reset(); this.removeAll(); }" />
        </Listeners>
    </ext:Store>
    
    
    
    
                    <ext:Button ID="btnSave" runat="server" Icon="Disk" TabIndex="119" Text="Save Incentive">
                        <Listeners>
                            <Click Handler="updateOrder();" />
                        </Listeners>
                    </ext:Button>
    I cannot seem to find any example of someone else using REST methods for store that is bound to form elements. Is there anyone out there that can provide me with a simple example of how to call the update REST method with a button?

    Any help on this would be appreciated... Thanks!
  2. #2
    Does anyone have any insight on this? It would be a big help.

    Thanks
  3. #3
    Bueller?? Frye?
  4. #4
    Hi,

    I think you should call the save method instead of the update one.
    Store1.save();

Similar Threads

  1. Restful Store and SubmitEmptyValue
    By Dimitris in forum 1.x Help
    Replies: 1
    Last Post: May 27, 2012, 6:41 PM
  2. Replies: 2
    Last Post: May 23, 2011, 10:45 AM
  3. [CLOSED] [1.0] Restful Store API
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Oct 22, 2010, 7:13 AM
  4. [CLOSED] [1.0] Store Restful
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Oct 04, 2010, 4:50 PM
  5. [CLOSED] Restful Store Question
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 20, 2010, 2:23 PM

Posting Permissions