【问题标题】:how to reset cookie when click function works in extjs4当点击功能在extjs4中起作用时如何重置cookie
【发布时间】:2012-11-16 13:20:42
【问题描述】:

我有一个包含商店的网格。为了将变量传递给存储。我使用了 cookie,但每次单击网格的一个数据时。 cookie的值等于第一次点击的值,所以第一次设置后不会改变。

那里的gridside:我尝试在单击数据时设置cookie。(通过使用setcookie)。我尝试删除Cookie,然后将 rec_dosya 声明为全局值,但它们不起作用。我该如何解决,谢谢

var fileGrid_yp_is = new Ext.grid.GridPanel({
           contextMenu: new Ext.menu.Menu({
           items: [
            {
             id: 'Kullanici_yetki_id',
             text: 'Izin verilen Kullanici Listelesi',
             iconCls:'icon-grid-del',            
             listeners : {

                click : function(){
                    rec_dosya   = fileGrid_yp_is.getSelectionModel().getSelected();
                    rec_dosya=rec_dosya.data.id;
                    alert(rec_dosya);
                    deleteCookie('icerik_id');
                    setCookie('icerik_id',rec_dosya,365);
                //  alert(rec_dosya);

                //usersListWin.extraP = { a:11231231, b: 1, c: 2}; // Add additional stuff
          user_store.reload();
          usersListWin.show();



                }

            }
        },
        ]
    }),
    listeners: {
        celldblclick : function(gridim,rIndex,cIndex,e) {
            rec_dosya   = fileGrid_yp_is.getSelectionModel().getSelected();
             deleteCookie('icerik_id');
                    setCookie('icerik_id',rec_dosya,365);
             this.contextMenu.showAt(e.getXY());
        }
    },

    store: fileStore_yp_is,
    sm: new Ext.grid.RowSelectionModel({
        singleSelect:true
    }),
    trackMouseOver: true,
    frame:false,
    width:'auto',
    height:'auto',
    autoScroll : true,
    tbar:tbarim
});

在店里,

我尝试通过在 baseparams(icerik_id) 中使用 getcookie 来获取数据

var user_store = new Ext.data.JsonStore({
    root: 'rows',
    autoLoad: true,
    model: 'users',
    totalProperty: 'results',
    remoteSort: true,
    proxy: new Ext.data.HttpProxy({
       url: 'phps/kullanici_islemleri.php',
       method:'POST'

    }),
    baseParams:{
          action:'yetki',
          icerik_id:getCookie('icerik_id')
    },
    fields: [{
            name :'id'
        },{
            name :'icerik_id'
        },{
            name:'username'
        },{
            name:'rol'
        },{
            name:'gorme'
        },{
            name:'olusturma'
        },{
            name:'silme'
        }
    ]
});

【问题讨论】:

  • 哪个版本?根据您实例化类的方式,看起来像 ExtJS3。并在发布代码时使用代码标签。您不能期望其他用户每次都为您这样做。
  • 那么首先你不应该使用new关键字,而是使用Ext.create();

标签: cookies extjs extjs4


【解决方案1】:

state managercookie provider 一起使用

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-04
    • 1970-01-01
    • 2017-05-29
    相关资源
    最近更新 更多