function getCUInstance()
{
document.getElementById("title1").innerHTML = "My VM Instances";
document.getElementById("content1").innerHTML = "";
Ext.QuickTips.init();
function changeStatus(val)
{
if (val == 0)
{
return '<span style="color:green;">pending</span>';
} else if (val == 1)
{
return '<span style="color:green;">running</span>';
}else if(val == 2)
{
return '<span style="color:green;">destroyed</span>';
}else{
return '<span style="color:green;">exception</span>';
}
}
//define model
Ext.define('ShowProductInstance', {
extend: 'Ext.data.Model',
fields: [
{name: 'productinstanceInstanceId', type: 'string'},
{name: 'productinstanceAliasName', type: 'string'},
{name: 'public_addresses', type: 'string'},
]
});
//loading data
var myStore = Ext.create('Ext.data.Store', {
model: 'ShowProductInstance',
proxy: {
type: 'ajax',
url : 'vm!vmInstance.action',
reader: {
type: 'json',
root: 'showProductInstance'
}
}
});
var grid = Ext.create('Ext.grid.Panel', {
//title: 'Company data',
store: myStore,
columns: [
{
header:'id',
id:'productinstanceInstanceId',
text:'productinstanceInstanceId',
hidden:true,
width:100,
dataIndex: 'productinstanceInstanceId'
},
{
header:'status',
text:'productinstanceStatus',
width:80,
sortable : true,
renderer:changeStatus,
dataIndex: 'productinstanceStatus'
},
{
header:'product',
xtype: 'actioncolumn',
width: 100,
items: [
{
icon:'../../resources/css/images/stoppic.png', // Use a URL in the icon config
tooltip:'stop instance',
handler:function(grid, rowIndex, colIndex)
{
var instance = myStore.getAt(rowIndex);
alert("id: " + instance.get('productinstanceInstanceId'));
}
},
{
icon:'../../resources/css/images/deletepic.png', // Use a URL in the icon config
tooltip:'delete instance',
handler:function(grid, rowIndex, colIndex)
{
var instance = myStore.getAt(rowIndex);
alert("id: " + instance.get('productinstanceInstanceId'));
}
}
]
}
]
});
myStore.load();
grid.render("content1");
}
分享到:
相关推荐
Sigma Grid 是一个基于 jQuery 的数据网格插件,用于在网页中展示和操作表格数据。它提供了丰富的功能,如分页、排序、过滤、编辑等,适用于各种数据密集型的Web应用。这个压缩包包含了关于 Sigma Grid 的使用指南和...
ag-grid中文一直是个问题,从网上找到了,中文版的js文件,经过改造后,实现了ag-grid中文转换。 在程序中locales中新建文件夹,拷贝,然后在程序中调用。比如 import { AG_GRID_LOCALE_CH } from '@/locales/ag-...
UltimateGrid是一款强大的MFC(Microsoft Foundation Class Library)控件,完全使用C++语言编写,专为商业级应用设计。这款控件以其优秀的性能、高度的可定制性和丰富的功能,深受开发者喜爱。与同类产品如GridCtrl...
Ag-Grid是一款强大的数据网格组件,常用于JavaScript和TypeScript项目中,特别是在处理大量数据时,它提供了丰富的功能和优秀的性能。在这个"Ag-Grid Demo2.7z"压缩包中,你将找到一个示例项目,展示了如何在实际...
本篇文章将深入探讨两种流行的JavaScript表格组件——GT-Grid和EXT-Grid,并通过对比分析它们的特点、功能和使用场景,以帮助开发者选择最适合项目需求的组件。 GT-Grid与EXT-Grid都是用于构建高性能、可定制的表格...
网格布局(Grid布局)是CSS3中的一个强大工具,它为网页设计提供了二维的、基于网格的布局系统,使得在创建复杂且响应式的页面布局时更加灵活和有序。本综合Demo案例将深入探讨如何利用Grid布局来实现各种复杂的网页...
在Windows Forms应用程序开发中,`PropertyGrid`控件是一个强大的工具,它允许用户以图形化的方式查看和修改对象的属性。这个控件主要用于提供一种直观的界面,让用户能够配置对象的属性,通常用于设置控件的外观和...
在.NET Framework中,`PropertyGrid`控件是一个非常强大的工具,用于在用户界面中显示对象的属性,并允许用户进行交互式编辑。这个控件广泛应用于各种应用程序的设置或配置界面,因为它可以自动根据对象的属性生成一...
本教程主要聚焦于两种常用的布局容器:Grid和UniformGrid。 一、Grid布局 Grid是WPF中最基本且强大的布局容器之一,它将窗口划分为一个二维网格,每个单元格可以容纳一个或多个控件。Grid的一个显著特点是其灵活性...