flex 高手进来看看!!分不是问题!!datagride 合并单元格问题。谢谢!!

wanglovehuang 2009-06-03 06:20:51
要实现的效果 请看附件!

谢谢
请高手给个思路! 最高能有以前做过的,谢谢
...全文
371 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
hlily2005 2009-09-22
  • 打赏
  • 举报
回复
给了API的例子,却不说明
woyaowenzi 2009-08-21
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 kellerxq 的回复:]
JScript code<?xml version="1.0"?><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="creationCompleteHandler();"><mx:Script><![CDATA[
import mx.rpc.AsyncResponder;
import mx.rpc.AsyncToken;
import mx.olap.OLAPQuery;
import mx.olap.OLAPSet;
import mx.olap.IOLAPQuery;
import mx.olap.IOLAPQueryAxis;
import mx.olap.IOLAPCube;
import mx.olap.OLAPResult;
import mx.events.CubeEvent;
import mx.controls.Alert;
import mx.collections.ArrayCollection;//// Format of Objects in the ArrayCollection://// data:Object = {// customer:"AAA",// product:"ColdFusion",// quarter:"Q1"// revenue: "100.00"// }//
[Bindable]
privatevar flatData:ArrayCollection=new ArrayCollection(
[
{customer:"AAA", product:"ColdFusion", quarter:"Q1", revenue:210, cost:25},
{customer:"AAA", product:"Flex", quarter:"Q2", revenue:210, cost:25},
{customer:"AAA", product:"Dreamweaver", quarter:"Q3", revenue:250, cost:125},
{customer:"AAA", product:"Flash", quarter:"Q4", revenue:430, cost:75},

{customer:"BBB", product:"ColdFusion", quarter:"Q2", revenue:125, cost:20},
{customer:"BBB", product:"Flex", quarter:"Q3", revenue:210, cost:20},
{customer:"BBB", product:"Dreamweaver", quarter:"Q4", revenue:320, cost:120},
{customer:"BBB", product:"Flash", quarter:"Q1", revenue:280, cost:70},

{customer:"CCC", product:"ColdFusion", quarter:"Q3", revenue:375, cost:120},
{customer:"CCC", product:"Flex", quarter:"Q4", revenue:430, cost:120},
{customer:"CCC", product:"Dreamweaver", quarter:"Q1", revenue:470, cost:220},
{customer:"CCC", product:"Flash", quarter:"Q2", revenue:570, cost:170},

{customer:"AAA", product:"ColdFusion", quarter:"Q4", revenue:215, cost:90},
{customer:"AAA", product:"Flex", quarter:"Q1", revenue:210, cost:90},
{customer:"AAA", product:"Dreamweaver", quarter:"Q2", revenue:175, cost:190},
{customer:"AAA", product:"Flash", quarter:"Q3", revenue:670, cost:75},

{customer:"BBB", product:"ColdFusion", quarter:"Q1", revenue:175, cost:20},
{customer:"BBB", product:"Flex", quarter:"Q2", revenue:210, cost:20},
{customer:"BBB", product:"Dreamweaver",quarter:"Q3", revenue:120, cost:120},
{customer:"BBB", product:"Flash", quarter:"Q4", revenue:310, cost:70},

{customer:"CCC", product:"ColdFusion", quarter:"Q1", revenue:385, cost:120},
{customer:"CCC", product:"Flex", quarter:"Q2", revenue:340, cost:120},
{customer:"CCC", product:"Dreamweaver", quarter:"Q3", revenue:470, cost:220},
{customer:"CCC", product:"Flash", quarter:"Q4", revenue:270, cost:170},

{customer:"AAA", product:"ColdFusion", quarter:"Q1", revenue:100, cost:25},
{customer:"AAA", product:"Flex", quarter:"Q2", revenue:150, cost:25},
{customer:"AAA", product:"Dreamweaver", quarter:"Q3", revenue:200, cost:125},
{customer:"AAA", product:"Flash", quarter:"Q4", revenue:300, cost:75},

{customer:"BBB", product:"ColdFusion", quarter:"Q2", revenue:175, cost:20},
{customer:"BBB", product:"Flex", quarter:"Q3", revenue:100, cost:20},
{customer:"BBB", product:"Dreamweaver", quarter:"Q4", revenue:270, cost:120},
{customer:"BBB", product:"Flash", quarter:"Q1", revenue:370, cost:70},

{customer:"CCC", product:"ColdFusion", quarter:"Q3", revenue:410, cost:120},
{customer:"CCC", product:"Flex", quarter:"Q4", revenue:300, cost:320},
{customer:"CCC", product:"Dreamweaver", quarter:"Q1", revenue:510, cost:220},
{customer:"CCC", product:"Flash", quarter:"Q2", revenue:620, cost:170},

{customer:"AAA", product:"ColdFusion", quarter:"Q4", revenue:215, cost:90},
{customer:"AAA", product:"Flex", quarter:"Q1", revenue:210, cost:90},
{customer:"AAA", product:"Dreamweaver", quarter:"Q2", revenue:175, cost:190},
{customer:"AAA", product:"Flash", quarter:"Q3", revenue:420, cost:75},

{customer:"BBB", product:"ColdFusion", quarter:"Q1", revenue:240, cost:20},
{customer:"BBB", product:"Flex", quarter:"Q2", revenue:100, cost:20},
{customer:"BBB", product:"Dreamweaver", quarter:"Q3", revenue:270, cost:120},
{customer:"BBB", product:"Flash", quarter:"Q4", revenue:370, cost:70},

{customer:"CCC", product:"ColdFusion", quarter:"Q1", revenue:375, cost:120},
{customer:"CCC", product:"Flex", quarter:"Q2", revenue:420, cost:120},
{customer:"CCC", product:"Dreamweaver", quarter:"Q3", revenue:680, cost:220},
{customer:"CCC", product:"Flash", quarter:"Q4", revenue:570, cost:170}
]);

privatefunction creationCompleteHandler():void {// You must initialize the cube before you// can execute a query on it. myMXMLCube.refresh();
}// Create the OLAP query. privatefunction getQuery(cube:IOLAPCube):IOLAPQuery {// Create an instance of OLAPQuery to represent the query.var query:OLAPQuery=new OLAPQuery;// Get the row axis from the query instance.var rowQueryAxis:IOLAPQueryAxis=
query.getAxis(OLAPQuery.ROW_AXIS);// Create an OLAPSet instance to configure the axis.var productSet:OLAPSet=new OLAPSet;// Add the Product to the row to aggregate data// by the Product dimension. productSet.addElements(
cube.findDimension("ProductDim").findAttribute("Product").children);// Add the OLAPSet instance to the axis. rowQueryAxis.addSet(productSet);// Get the column axis from the query instance, and configure it// to aggregate the columns by the Quarter dimension.var colQueryAxis:IOLAPQueryAxis=
query.getAxis(OLAPQuery.COLUMN_AXIS);var quarterSet:OLAPSet=new OLAPSet;
quarterSet.addElements(
cube.findDimension("QuarterDim").findAttribute("Quarter").children);
colQueryAxis.addSet(quarterSet);return query;
}// Event handler to execute the OLAP query// after the cube completes initialization. privatefunction runQuery(event:CubeEvent):void {// Get cube.var cube:IOLAPCube= IOLAPCube(event.currentTarget);// Create a query instance.var query:IOLAPQuery= getQuery(cube);// Execute the query.var token:AsyncToken= cube.execute(query);// Setup handlers for the query results. token.addResponder(new AsyncResponder(showResult, showFault));
}// Handle a query fault. privatefunction showFault(result:Object, token:Object):void {
Alert.show("Error in query.");
}// Handle a successful query by passing the query results to// the OLAPDataGrid control.. privatefunction showResult(result:Object, token:Object):void {if (!result) {
Alert.show("No results from query.");return;
}
myOLAPDG.dataProvider= result as OLAPResult;
}
]]></mx:Script><mx:OLAPCube name="FlatSchemaCube"
dataProvider="{flatData}"
id="myMXMLCube"
complete="runQuery(event);"><mx:OLAPDimension name="CustomerDim"><mx:OLAPAttribute name="Customer" dataField="customer"/><mx:OLAPHierarchy name="CustomerHier" hasAll="true"><mx:OLAPLevel attributeName="Customer"/></mx:OLAPHierarchy></mx:OLAPDimension><mx:OLAPDimension name="ProductDim"><mx:OLAPAttribute name="Product" dataField="product"/><mx:OLAPHierarchy name="ProductHier" hasAll="true"><mx:OLAPLevel attributeName="Product"/></mx:OLAPHierarchy></mx:OLAPDimension><mx:OLAPDimension name="QuarterDim"><mx:OLAPAttribute name="Quarter" dataField="quarter"/><mx:OLAPHierarchy name="QuarterHier" hasAll="true"><mx:OLAPLevel attributeName="Quarter"/></mx:OLAPHierarchy></mx:OLAPDimension><mx:OLAPMeasure name="Revenue"
dataField="revenue"
aggregator="SUM"/></mx:OLAPCube><mx:Panel title="OLAPCube Control Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"><mx:OLAPDataGrid id="myOLAPDG" width="100%" height="100%"/></mx:Panel></mx:Application>
[/Quote]

并没有实现真正意义上的合并和拆分。很想知道楼主是怎样合并行的,能否给些代码。
fw176170847 2009-07-25
  • 打赏
  • 举报
回复
需要自定义组件
charley365 2009-07-23
  • 打赏
  • 举报
回复
借本版发个启事,还请版主谅解:本人有个很好的点子想申请专利,由于该专利涉及到程序设计方面的问题,可是本人又不怎么懂这方面的知识!有哪位老师能告诉我下这方面的知识呀?也可以合作开发,有兴趣的请留言:charley214@163.com
wanglovehuang 2009-06-09
  • 打赏
  • 举报
回复
谢谢上面的那位 高手
能给个QQ号吗 我要像你学习 太谢谢你了
kellerxq 2009-06-08
  • 打赏
  • 举报
回复
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="creationCompleteHandler();">

<mx:Script>
<![CDATA[
import mx.rpc.AsyncResponder;
import mx.rpc.AsyncToken;
import mx.olap.OLAPQuery;
import mx.olap.OLAPSet;
import mx.olap.IOLAPQuery;
import mx.olap.IOLAPQueryAxis;
import mx.olap.IOLAPCube;
import mx.olap.OLAPResult;
import mx.events.CubeEvent;
import mx.controls.Alert;
import mx.collections.ArrayCollection;


//
// Format of Objects in the ArrayCollection:
//
// data:Object = {
// customer:"AAA",
// product:"ColdFusion",
// quarter:"Q1"
// revenue: "100.00"
// }
//

[Bindable]
private var flatData:ArrayCollection = new ArrayCollection(
[
{customer:"AAA", product:"ColdFusion", quarter:"Q1", revenue:210, cost:25},
{customer:"AAA", product:"Flex", quarter:"Q2", revenue:210, cost:25},
{customer:"AAA", product:"Dreamweaver", quarter:"Q3", revenue:250, cost:125},
{customer:"AAA", product:"Flash", quarter:"Q4", revenue:430, cost:75},

{customer:"BBB", product:"ColdFusion", quarter:"Q2", revenue:125, cost:20},
{customer:"BBB", product:"Flex", quarter:"Q3", revenue:210, cost:20},
{customer:"BBB", product:"Dreamweaver", quarter:"Q4", revenue:320, cost:120},
{customer:"BBB", product:"Flash", quarter:"Q1", revenue:280, cost:70},

{customer:"CCC", product:"ColdFusion", quarter:"Q3", revenue:375, cost:120},
{customer:"CCC", product:"Flex", quarter:"Q4", revenue:430, cost:120},
{customer:"CCC", product:"Dreamweaver", quarter:"Q1", revenue:470, cost:220},
{customer:"CCC", product:"Flash", quarter:"Q2", revenue:570, cost:170},

{customer:"AAA", product:"ColdFusion", quarter:"Q4", revenue:215, cost:90},
{customer:"AAA", product:"Flex", quarter:"Q1", revenue:210, cost:90},
{customer:"AAA", product:"Dreamweaver", quarter:"Q2", revenue:175, cost:190},
{customer:"AAA", product:"Flash", quarter:"Q3", revenue:670, cost:75},

{customer:"BBB", product:"ColdFusion", quarter:"Q1", revenue:175, cost:20},
{customer:"BBB", product:"Flex", quarter:"Q2", revenue:210, cost:20},
{customer:"BBB", product:"Dreamweaver",quarter:"Q3", revenue:120, cost:120},
{customer:"BBB", product:"Flash", quarter:"Q4", revenue:310, cost:70},

{customer:"CCC", product:"ColdFusion", quarter:"Q1", revenue:385, cost:120},
{customer:"CCC", product:"Flex", quarter:"Q2", revenue:340, cost:120},
{customer:"CCC", product:"Dreamweaver", quarter:"Q3", revenue:470, cost:220},
{customer:"CCC", product:"Flash", quarter:"Q4", revenue:270, cost:170},

{customer:"AAA", product:"ColdFusion", quarter:"Q1", revenue:100, cost:25},
{customer:"AAA", product:"Flex", quarter:"Q2", revenue:150, cost:25},
{customer:"AAA", product:"Dreamweaver", quarter:"Q3", revenue:200, cost:125},
{customer:"AAA", product:"Flash", quarter:"Q4", revenue:300, cost:75},

{customer:"BBB", product:"ColdFusion", quarter:"Q2", revenue:175, cost:20},
{customer:"BBB", product:"Flex", quarter:"Q3", revenue:100, cost:20},
{customer:"BBB", product:"Dreamweaver", quarter:"Q4", revenue:270, cost:120},
{customer:"BBB", product:"Flash", quarter:"Q1", revenue:370, cost:70},

{customer:"CCC", product:"ColdFusion", quarter:"Q3", revenue:410, cost:120},
{customer:"CCC", product:"Flex", quarter:"Q4", revenue:300, cost:320},
{customer:"CCC", product:"Dreamweaver", quarter:"Q1", revenue:510, cost:220},
{customer:"CCC", product:"Flash", quarter:"Q2", revenue:620, cost:170},

{customer:"AAA", product:"ColdFusion", quarter:"Q4", revenue:215, cost:90},
{customer:"AAA", product:"Flex", quarter:"Q1", revenue:210, cost:90},
{customer:"AAA", product:"Dreamweaver", quarter:"Q2", revenue:175, cost:190},
{customer:"AAA", product:"Flash", quarter:"Q3", revenue:420, cost:75},

{customer:"BBB", product:"ColdFusion", quarter:"Q1", revenue:240, cost:20},
{customer:"BBB", product:"Flex", quarter:"Q2", revenue:100, cost:20},
{customer:"BBB", product:"Dreamweaver", quarter:"Q3", revenue:270, cost:120},
{customer:"BBB", product:"Flash", quarter:"Q4", revenue:370, cost:70},

{customer:"CCC", product:"ColdFusion", quarter:"Q1", revenue:375, cost:120},
{customer:"CCC", product:"Flex", quarter:"Q2", revenue:420, cost:120},
{customer:"CCC", product:"Dreamweaver", quarter:"Q3", revenue:680, cost:220},
{customer:"CCC", product:"Flash", quarter:"Q4", revenue:570, cost:170}
]);

private function creationCompleteHandler():void {
// You must initialize the cube before you
// can execute a query on it.
myMXMLCube.refresh();
}

// Create the OLAP query.
private function getQuery(cube:IOLAPCube):IOLAPQuery {
// Create an instance of OLAPQuery to represent the query.
var query:OLAPQuery = new OLAPQuery;

// Get the row axis from the query instance.
var rowQueryAxis:IOLAPQueryAxis =
query.getAxis(OLAPQuery.ROW_AXIS);
// Create an OLAPSet instance to configure the axis.
var productSet:OLAPSet = new OLAPSet;
// Add the Product to the row to aggregate data
// by the Product dimension.
productSet.addElements(
cube.findDimension("ProductDim").findAttribute("Product").children);
// Add the OLAPSet instance to the axis.
rowQueryAxis.addSet(productSet);

// Get the column axis from the query instance, and configure it
// to aggregate the columns by the Quarter dimension.
var colQueryAxis:IOLAPQueryAxis =
query.getAxis(OLAPQuery.COLUMN_AXIS);
var quarterSet:OLAPSet= new OLAPSet;
quarterSet.addElements(
cube.findDimension("QuarterDim").findAttribute("Quarter").children);
colQueryAxis.addSet(quarterSet);

return query;
}

// Event handler to execute the OLAP query
// after the cube completes initialization.
private function runQuery(event:CubeEvent):void {
// Get cube.
var cube:IOLAPCube = IOLAPCube(event.currentTarget);
// Create a query instance.
var query:IOLAPQuery = getQuery(cube);
// Execute the query.
var token:AsyncToken = cube.execute(query);
// Setup handlers for the query results.
token.addResponder(new AsyncResponder(showResult, showFault));
}

// Handle a query fault.
private function showFault(result:Object, token:Object):void {
Alert.show("Error in query.");
}

// Handle a successful query by passing the query results to
// the OLAPDataGrid control..
private function showResult(result:Object, token:Object):void {
if (!result) {
Alert.show("No results from query.");
return;
}
myOLAPDG.dataProvider= result as OLAPResult;
}
]]>
</mx:Script>

<mx:OLAPCube name="FlatSchemaCube"
dataProvider="{flatData}"
id="myMXMLCube"
complete="runQuery(event);">

<mx:OLAPDimension name="CustomerDim">
<mx:OLAPAttribute name="Customer" dataField="customer"/>
<mx:OLAPHierarchy name="CustomerHier" hasAll="true">
<mx:OLAPLevel attributeName="Customer"/>
</mx:OLAPHierarchy>
</mx:OLAPDimension>

<mx:OLAPDimension name="ProductDim">
<mx:OLAPAttribute name="Product" dataField="product"/>
<mx:OLAPHierarchy name="ProductHier" hasAll="true">
<mx:OLAPLevel attributeName="Product"/>
</mx:OLAPHierarchy>
</mx:OLAPDimension>

<mx:OLAPDimension name="QuarterDim">
<mx:OLAPAttribute name="Quarter" dataField="quarter"/>
<mx:OLAPHierarchy name="QuarterHier" hasAll="true">
<mx:OLAPLevel attributeName="Quarter"/>
</mx:OLAPHierarchy>
</mx:OLAPDimension>

<mx:OLAPMeasure name="Revenue"
dataField="revenue"
aggregator="SUM"/>
</mx:OLAPCube>

<mx:Panel title="OLAPCube Control Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10">

<mx:OLAPDataGrid id="myOLAPDG" width="100%" height="100%"/>
</mx:Panel>
</mx:Application>
wanglovehuang 2009-06-08
  • 打赏
  • 举报
回复
有人用过这个组件没有啊
MecGrid
要是用过给介绍下 谢谢 我在网上搜不到这方面的例子
island_001 2009-06-08
  • 打赏
  • 举报
回复
不是很清楚! 你可不可以换出一行来然后循环这行可以不??  反正看起来有这样的一个效果
herowach 2009-06-05
  • 打赏
  • 举报
回复
没做过,貌似不行,横着的是在一个ITEM内,纵向的是由多个ITEM组成的,你还不如耍个花头,把其中的某一行填上值,然后其他行的那格数据都空着,看起来向那个样就行了
lingyin55 2009-06-04
  • 打赏
  • 举报
回复
帮楼主顶下,发现这里学习热情并不高啊、、、
wanglovehuang 2009-06-04
  • 打赏
  • 举报
回复
哦 谢谢 但是我现在一点思路都没有

我现在就想知道是怎样 合并和拆分 给点思路 谢谢!!
我现在可以横的合并 我用的是这个组件 AdvancedDataGrid
不知道 竖直的合并


maninwater 2009-06-04
  • 打赏
  • 举报
回复
datagride 组件不支持单元格的合并与拆分,想要这样的东西,需要自己去写

4,328

社区成员

发帖
与我相关
我的任务
社区描述
多媒体/设计 Flex
社区管理员
  • Flex
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧