是否有一种标准方法可以访问interactiveGrid 小部件和子小部件的方法? [英] Is there a standard way to get access to interactiveGrid widget's and subwidgets' methods?

查看:84
本文介绍了是否有一种标准方法可以访问interactiveGrid 小部件和子小部件的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Oracle AEPX 20.2.在左侧面板的顶部 Docs,有许多小部件.我假设所有这些都是 interactiveGrid 小部件的子小部件,除了 treeview 小部件,对吗?如果对或错,是否有一种标准方法可以让我访问这些小部件的方法?我尝试了 apex.region("regionStaticId).call('methodName'); 但它似乎只允许访问 InteractiveGrid 小部件的方法.

I am using Oracle AEPX 20.2. At the top of the left panel here Docs, there are a number of widgets. I assume all of them are sub widgets to the interactiveGrid widget except for treeview widget, am I right? If right or wrong, is there a standard way that get me access to those widgets' methods? I tried apex.region("regionStaticId).call('methodName'); but it seems to give access only to interactiveGrid widget's methods.

推荐答案

对..call 只会让您访问主小部件 - interactiveGrid 小部件.使用.call,您可以调用诸如刷新、焦点、调整大小等内容.这些是您可以为所有 IG 视图调用的方法.它们非常通用.但最重要的是,interactiveGrid 小部件还包含方法 getCurrentViewgetViews.

Right. .call will only give you access to the main widget- the interactiveGrid widget. With .call you can invoke things like refresh, focus, resize, etc. These are methods which you can invoke for all IG views. They are very generic. But most importantly, the interactiveGrid widget also contains the methods getCurrentView and getViews.

通过这 2 个,您将获得 interactiveGridView 接口的实例.最值得注意的是,这个实例将包含对底层模型的引用,还有一个名为 view$ 的 jQuery 对象,它指向实现更具体的 jQueryUI 小部件(如 grid)的 DOM 元素>(被默认的表如视图使用)或 tableModelView(被细节和图标视图使用).

Via these 2, you will get an instance of the interactiveGridView interface. Most notabily, this instance will contain a reference to the underlying model, but also a jQuery object named view$, which points to the DOM elemenent implementing the more specific jQueryUI widgets like grid (used by the default table like view) or tableModelView (used by detail and icon view).

对于 99% 的情况,您实际上只能使用网格视图,因此这就足够了:

For 99% of cases, you'll really only have the grid view available, so this will suffice:

apex.region('emp').call('getCurrentView').view$.grid(<<gridWidgetMethod>>);

如果您还启用了图标视图或详细信息视图,getCurrentView 可能还不够,因此我们必须使用 getViews,并准确指定我们想要的内容.因此,对于详细信息视图,您可能会执行以下操作:

If you have also enabled an icon view or a detail view, getCurrentView might not be enough, so we have to use getViews, and specify exactly what we want. So for the detail view, you might do something like this:

apex.region('emp').call('getViews', 'detail').view$.tableModelView(<<tableModelViewWidgetMethod>>);

请注意,要使某些 detailModelView 方法起作用,您的标记必须遵循一些准则,例如每条记录都有一个 data-id 属性集.查看文档了解更多信息.

Note that for some of the detailModelView methods to work, your markup must follow some guidelines, like each record having a data-id attribute set. Have a look at the documentation for more info.

对于图标视图略有不同.

For the icon view is slightly different.

apex.region('emp').call('getViews', 'icon').view$.tableModelView('getIconList').<<iconListMethod>>()

它也是一个 tableModelView 小部件,它在内部创建了一个 iconView 小部件.为了达到这个目的,我们必须调用 getIconList.但是,这不会返回 jQuery 对象,而是返回实际的小部件(内部)实例.所以方法是直接调用的,而不是将它们作为字符串传入.

It's also a tableModelView widget, which internally creates an iconView widget. To get to this one, we must call getIconList. However, this will not return a jQuery object, but the actual widget (internal) instance. So methods are called directly, and not by passing them in as strings.

请记住,view$ 属性仅在您单击进入该视图后才可用.如果您有网格视图和图标视图,而用户只在网格视图中工作,则图标 1 尚不可用.它必须首先初始化.

Keep in mind the view$ property will only be available once you've clicked into that view. If you have a grid view and icon view, and the user has only been working in the grid view, the icon one will not be yet available. It must have first initialized.

recordView 也略有不同.因为它只存在于网格视图的上下文中,所以我们可以像这样获得对它的引用:

The recordView is also slightly different. Because it only exists in context of the grid view, we can get a reference to it like this:

apex.region('emp').call('getViews', 'grid').singleRowView$.recordView(<<recordViewWidgetMethod>>);

此图试图解释 IG建筑学.它有点过时了,例如groupByView"还没有进入 APEX(至少),但它完成了工作.

This diagram attempts to explain the IG architecture. It is somewhat out of date, for example the "groupByView" hasn't made it into APEX (yet at least), but it does the job.

概述

var region = apex.region('emp');
var gridView = region.call('getViews', 'grid').view$;       // must have been initialized
var detailView = region.call('getViews', 'detail').view$;   // must have been initialized
var iconDetailView = region.call('getViews', 'icon').view$; // must have been initialized
var iconViewWidget = iconDetailView.tableModelView('getIconList');

// calling the refresh method of the different views
gridView.grid('refresh');
detailView.tableModelView('refresh');
iconViewWidget.refresh();


简而言之,似乎没有标准方式";调用这些特定的视图方法.获取每个视图的方式不同,使用它们时需要考虑不同的方面.


In short, there doesn't appear to be a "standard way" of invoking these specific view methods. There is a different way to get to each view, and different aspects to consider when working with them.

这篇关于是否有一种标准方法可以访问interactiveGrid 小部件和子小部件的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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