日期:2014-05-17  浏览次数:20657 次

Extjs4.0删除操作??


就是要怎么才能获取一个grid的一列的id??

部分代码:
Java code
   sta:function(val){
        var _str="";
        if(val==0){
        _str="<span style='color:blue;' onclick=tianj()>添加</span>";
        _str=_str+"|";
        _str=_str+"<span style='color:blue;'  onclick=jggledit(jggl_bj)>编辑</span>";
        _str=_str+"|";
        _str=_str+"<span style='color:blue;' 'href=remove.do?VBranch.id=%{VBranch.id}', onclick=jgglremove()>删除</span>";
        }
        return _str;
        }


------解决方案--------------------
function callback(answer){
if(answer == 'yes')
{
Ext.Ajax.request({
url: "jsglconfig/removeJsgl.do?rid="+rid,
success: function(response, opts) {

var jsStore = Ext.getCmp('jsglgrid').getStore();

//匹配要删除的id在当前store中的位置
var deleteInx = 0;
jsStore.each(function(item,index,countriesItSelf){
if(rid == jsStore.getAt(index).data.id)
{
deleteInx = index;
}

});
//重写数据到store里
var newdata = "{'id':'"+jsStore.getAt(deleteInx).data.id+"','name':'"+jsStore.getAt(deleteInx).data.name+"','createTime':'" +jsStore.getAt(deleteInx).data.createTime+ "','userCount':'"+jsStore.getAt(deleteInx).data.userCount+"','status1':'cc|删除未审核'}"
jsStore.removeAt(deleteInx);
jsStore.insert(deleteInx,Ext.decode(newdata));

},
failure: function(response, opts) {
console.log('server-side failure with status code ' + response.status);
}
});
}