0

This is My Store

  Ext.define('Movie.store.CartStore', {
    extend: 'Ext.data.Store',
    alias: 'store.cart',
    storeId: 'cartStore',
    requires: [
        'Movie.model.CartModel'
    ],

    constructor: function(cfg) {
        var me = this;
        cfg = cfg || {};
        me.callParent([Ext.apply({
            autoLoad: true,
            autoSync: true,
            model: 'Movie.model.CartModel',
            remoteSort: true,
            proxy: {
              type: 'rest',
              enablePaging: true,
              api: {
                create: 'https://localhost:44369/Movies/AddCart',
                read: 'https://localhost:44369/Movies/GetCart',
                update: 'https://localhost:44369/Movies/EditCart',
                destroy: 'https://localhost:44369/Movies/DeleteCart'
              },
              reader: {
                type: 'json',
                headers: { 'Accept': 'application/json' }
              },
              writer: {
                type: 'json',
              }
            }
        }, cfg)]);
    }
});
  

My Model

Ext.define('Movie.model.CartModel', {
    extend: 'Movie.model.Base',
    idProperty:'Id',
    uses: [
        'Movie.model.UsersModel'
    ],
    fields: [
        { name: 'Id', type: 'int' , persist: false},
        { name: 'userid', type: 'int' },
        { name: 'name', type: 'string' },
        { name: 'moviename', type: 'string' },
        { name: 'address', type: 'string' },
        { name: 'price', type: 'int' },
        { name: 'rentday', type: 'string' },
        { name: 'url', type: 'string' },
    ]

});

Web APi Req..

   [Route("Movies/GetCart/{id}")]
        [HttpGet]
        [EnableCors("*", "*", "*")]
        public IHttpActionResult GetCart(int? id)
        {

            using (var ctx = new MyEntity())
            {
                var data = from cus in db.Users
                           from mov in db.Movie
                           from cart in db.Movie_cart
                           where cus.CustomerId ==cart.CustomerId &&  mov.Movie_id ==cart.Movie_Id && cus.CustomerId == id
                           select new
                           {
                               Id = cart.Cart_id,
                               userid = cus.CustomerId,
                               name = cus.Fname,
                               moviename = mov.Movie_name,
                               address = cus.Address,
                               price = mov.Movie_price,
                               rentday = mov.Rent_day,
                               url = mov.Movie_url


                           };
                return Ok(data);
            }


        }

So I want to Pass Ide to My rest Proxy Url SOmething Like This

https://localhost:44369/Movies/GetCart/123

I dont not have have any Idea Ill Try using

extraParams:{
id:123
}

and Disable appendId: false But not solve my issue it returns

https://localhost:44369/Movies/GetCart?dc_23213124124124&id=123 instead of https://localhost:44369/Movies/GetCart/123

  • I don't really understand. In case of a REST proxy the id is automatically added to the request URL if the request is about a single instance and the id is present. You can set a different `idProperty` or you can disable appending id with `appendId`, but if you need a different logic maybe you should not use REST but other proxy. – Peter Koltai May 05 '23 at 08:07
  • Im just need to send Parameter for Get MetHOd to GET information By specific parameter for example in a plain QUERY in SQL " SELECT * FROM table_users WHERE id=123 – dota2bryan beltran May 06 '23 at 06:29

1 Answers1

0

dc_ param is for caching. You can deactivate this in store/model when you set noCache to false:

Ext.define('Modelname', {
       extend: 'Ext.data.Model',
    
       fields: [...],
    
       proxy: {
          url: 'proxyurl',
          noCache: false
       }
    })

Its possible to do this globally with:

Ext.Ajax.disableCaching = false;

You should check out other posts: https://stackoverflow.com/a/2047783/21182733 https://stackoverflow.com/a/25409972/21182733

Tech-Maou
  • 30
  • 4