Aras学习笔记 (13) Javascript端常用代码代码汇总(陆续更新中)

1、获取Innovator对象:  

var inn = Innovator();

2、得到当前Item类型: 

var itemType = document.thisItem.getType();

3、得到Item对象:

var item_color = inn.newItem("Ext_SetTabColor");

item_color.setProperty("EXT_ITEM", "B88C14B99EF449828C5D926E39EE8B89"); 

item_color.setAttribute("select", "ext_item,ext_tab_color,ext_tab_name(name,label), ext_tab_font_color");

4、得到当前用户ID:

Innovator inn = this.getInnovator();
var UserId = inn.getUserID();

5、在菜单按钮中刷新当前Grid(执行当前查询):

var topWindow = aras.getMostTopWindowWithAras(window);
var workerFrame = topWindow.work;
if (workerFrame && workerFrame.searchContainer) {
	workerFrame.searchContainer.runSearch();
}

6、在弹出窗口中刷新父窗口中的Grid:

var topWindow = parent.aras.getMostTopWindowWithAras(window);
var workerFrame = topWindow.work;
if (workerFrame && workerFrame.searchContainer) {
    workerFrame.searchContainer.runSearch();
}

 7、当前Grid内容导出Excel:

var topWindow = aras.getMostTopWindowWithAras(window);
var workerFrame = topWindow.work;
var gridXmlCallback = function() {
	return workerFrame.grid.getXML(true);
};
aras.export2Office(gridXmlCallback, 'export2Excel', undefined, workerFrame.itemTypeName);

8、当前Grid内容导出Word:

var topWindow = aras.getMostTopWindowWithAras(window);
var workerFrame = topWindow.work;
var gridXmlCallback = function() {
	return workerFrame.grid.getXML(false);
};
aras.export2Office(gridXmlCallback, 'export2Word');

9、菜单按钮中得到当前选中Item的ID:

var topWindow = aras.getMostTopWindowWithAras(window);

var workerFrame = topWindow.work;
alert(workerFrame.grid.getSelectedID());

10、菜单按钮中得到当前选中全部Item的ID列表:

var topWindow = aras.getMostTopWindowWithAras(window);

var workerFrame = topWindow.work;
alert(workerFrame.grid.getSelectedItemIDs(","));

 

...

n、循环Item对象中的内容及属性:

if (item_color.isError() || item_color.getItemCount() === 0)
{             
  //数据读取失败,返回
  return this;
}
else
{
  //循环Item内容   for (var i = 0; i < item_color.getItemCount(); i++)   {
    //属性     var item = item_color.getItemByIndex(i);     alert(item.getProperty("ext_tab_color"));     alert(item.getProperty("ext_tab_font_color"));   } }
posted @ 2018-11-23 14:37  无敌师爷IT技术Blog  阅读(1050)  评论(0编辑  收藏  举报