如何使用TooltipDialog(和DropDownButton)更新Dojo网格单元格值 [英] How to update a Dojo Grid cell value using a TooltipDialog (and DropDownButton)

查看:117
本文介绍了如何使用TooltipDialog(和DropDownButton)更新Dojo网格单元格值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个dojo网格,它使用一些可编辑的dijit表单字段。一切都很好,直到我尝试执行一个国家(多)选择单元格作为工具提示对话框;即显示一个下拉按钮,该按钮打开用复选框阵列填充的工具提示对话框,以选择一个或多个国家。一旦选中并单击确定,单元格将更新一个所选国家/地区的列表。显然,我稍后会通过商店来更新服务器。



我已经实施了一个国家/地区选择工具提示对话框,如下所示:

  dojo.provide( CountrySelector); 
dojo.declare(
CountrySelector,
[dijit.form.DropDownButton],
{
标签:'Countries',
dropDown:new dijit.TooltipDialog({execute:function(){
console.log(EXECUTE:,arguments [0]);
this.value = arguments [0] .country;
} ,href:'/ cm / ui / countries'}),

postCreate:function(){
this.inherited(arguments);
this.label = this.value ;
dojo.connect(this.dropDown,'onClose',function(){console.log('close');});

console.log(CountrySelect post create ,这个);

},
}
);

网格单元格键入:

  {name:'Countries',field:'targeting.countries',可编辑:true,hidden:false,键入:dojox.grid.cells._Widget,widgetClass:CountrySelector},

所有的工作都很好,但是我不知道如何更新单元格的内容和存储一旦窗口小部件执行。同样,我似乎没有更新行的行ID。



任何想法?



谢谢,
Harel

解决方案

我曾经更新我的网格

  var idx = yourGrid.getItemIndex(item); 
if(idx> - 1){
yourGrid.updateRow(idx);
}






更多细节





每一行都由其标识符标识

  yourGrid.store.fetchItemByIdentity({
identity:< yourIdentity>
onItem:function(item){
//根据服务器响应更新商店中的属性
// yourGrid.store.setValue(item,< attribute>,< value>);
var idx = yourGrid.getItemIndex(item);
if(idx> - 1 ){
yourGrid.updateRow(idx);
}
}
});


I have a dojo grid which is using some editable dijit form fields. All is well, until I try ot implement an country (multi) select cell as an Tooltip Dialog; i.e., show a drop down button which opens the tooltip dialog populated with a checkbox array to select one or more country. Once checked and clicked OK, the cell should update with a list of selected countries. Obviously I'll take care of updating the server via the store later on.

I've implemented a country select tooltip dialog which works fine like so:

dojo.provide("CountrySelector");  
dojo.declare(
    "CountrySelector",
    [dijit.form.DropDownButton],
    {
        label: 'Countries',
        dropDown: new dijit.TooltipDialog({ execute: function() { 
                                                console.log("EXECUTE : ", arguments[0]);
                                                this.value = arguments[0].country;
                                                }, href:'/cm/ui/countries' }),

        postCreate: function() {
            this.inherited(arguments);
            this.label = this.value;
            dojo.connect(this.dropDown, 'onClose', function() {  console.log('close');  });  

            console.log("CountrySelect post create", this);

        },
     }
);

And the grid cell is typed as:

{ name: 'Countries',           field: 'targeting.countries',           editable: true, hidden: false, type:dojox.grid.cells._Widget, widgetClass: CountrySelector  },

All is working fine but I can't figure out how to update cell's content and store once the widget is executed. As well, I don't seem to have the row id of the updated row.

Any ideas?

Thanks, Harel

解决方案

This is what i used to update my grid

var idx = yourGrid.getItemIndex(item);
if (idx >- 1) {
    yourGrid.updateRow(idx);         
}


More detail


every row is identified by its identifier

yourGrid.store.fetchItemByIdentity({
    identity: <yourIdentity>,
    onItem: function(item){
        // Update your attributes in the store depending on the server response
        // yourGrid.store.setValue(item, <attribute>,<value>);
        var idx = yourGrid.getItemIndex(item);
        if (idx >- 1) {
            yourGrid.updateRow(idx);        
        }
    }
});

这篇关于如何使用TooltipDialog(和DropDownButton)更新Dojo网格单元格值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆