如何禁用双击高级数据网格分组标题?

发布于 2024-10-13 06:03:30 字数 1222 浏览 5 评论 0原文

我有一个高级数据网格,上面有一个分组。对于分组内的项目,我进行了设置,双击一个项目,它将创建一个弹出窗口,允许用户编辑该条目。我遇到的问题是,我可以双击组标题,然后弹出窗口会被激活,其中包含空白信息。我如何防止这个工作?

这是mxml代码

<mx:AdvancedDataGrid id="plugList" designViewDataType="tree" width="100%" height="100%" 
         initialize="gc.refresh();" doubleClickEnabled="true" itemDoubleClick="plugList_itemDoubleClickHandler(event)">
        <mx:dataProvider>
            <mx:GroupingCollection2 id="gc" source="{plugs}">
                <mx:grouping>
                    <mx:Grouping>
                        <mx:GroupingField name="traderTitle"/>
                    </mx:Grouping>
                </mx:grouping>
            </mx:GroupingCollection2>
        </mx:dataProvider>
        <mx:columns>
            <mx:AdvancedDataGridColumn headerText="Title" dataField="traderTitle"/>
            <mx:AdvancedDataGridColumn headerText="Anchor" dataField="traderAnchor"/>
            <mx:AdvancedDataGridColumn headerText="URL" dataField="url"/>
            <mx:AdvancedDataGridColumn dataField="status" headerText="Status" width="75"/>
        </mx:columns>
    </mx:AdvancedDataGrid>

I have an advanced datagrid that has a grouping on it. With the items inside of the grouping I have it setup where you double click on an item and it will create a popup that allows the user to edit that entry. The problem that I am having is that I can double click on the group title and the popup is activated with blank information. How do I prevent this from working?

Here is the mxml code

<mx:AdvancedDataGrid id="plugList" designViewDataType="tree" width="100%" height="100%" 
         initialize="gc.refresh();" doubleClickEnabled="true" itemDoubleClick="plugList_itemDoubleClickHandler(event)">
        <mx:dataProvider>
            <mx:GroupingCollection2 id="gc" source="{plugs}">
                <mx:grouping>
                    <mx:Grouping>
                        <mx:GroupingField name="traderTitle"/>
                    </mx:Grouping>
                </mx:grouping>
            </mx:GroupingCollection2>
        </mx:dataProvider>
        <mx:columns>
            <mx:AdvancedDataGridColumn headerText="Title" dataField="traderTitle"/>
            <mx:AdvancedDataGridColumn headerText="Anchor" dataField="traderAnchor"/>
            <mx:AdvancedDataGridColumn headerText="URL" dataField="url"/>
            <mx:AdvancedDataGridColumn dataField="status" headerText="Status" width="75"/>
        </mx:columns>
    </mx:AdvancedDataGrid>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

始终不够爱げ你 2024-10-20 06:03:30

事件目标不是单行而是整个datagrid组件,您不能使用该对象。
如果selectionMode属性设置为singleRow(这是默认值),您可以使用selectedItem属性来指向目标行。
然后,您可以检查 Children 属性是否存在,以区分父节点和简单叶子。

这是一个简单的 doubleClick 监听器函数示例:

protected function plugList_itemDoubleClickHandler(event:ListEvent):void
{
    if(((Object)(event.target.selectedItem)).hasOwnProperty('children')){
        trace('not a leaf');
    }else{
        Alert.show("Selected  "+event.target.selectedItem.desc);
    }   
}

Davide

The event target is not the single row but the entire datagrid component, you cannot use this object.
If the selectionMode property is set to singleRow (which is the default), you can use the selectedItem property to point the target row.
Then you can check for the presence of the children property to distinguish between a father node and a simple leaf.

This is a simple doubleClick listener function example:

protected function plugList_itemDoubleClickHandler(event:ListEvent):void
{
    if(((Object)(event.target.selectedItem)).hasOwnProperty('children')){
        trace('not a leaf');
    }else{
        Alert.show("Selected  "+event.target.selectedItem.desc);
    }   
}

Davide

当梦初醒 2024-10-20 06:03:30

这将在plugList_itemDoubleClickHandler 函数中处理。有一个条件语句并查看 event.target,不确定它的语法,但在调试模式下,您应该能够看到您可以监视的项目和标头之间的差异。如果是标题,则不显示弹出窗口

That would be handled in the plugList_itemDoubleClickHandler function. Have a conditional statement to and look at the event.target, not sure of the syntax for it off hand, but in debug mode you should be able to see a difference between the item and header that you can watch for. If its a header, dont show the popup

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文