如何使用TooltipDialog(和DropDownButton)更新Dojo网格单元格值 [英] How to update a Dojo Grid cell value using a TooltipDialog (and DropDownButton)
问题描述
我已经实施了一个国家/地区选择工具提示对话框,如下所示:
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屋!