[flexcoders] Re: updating display of GroupingCollection on AdvancedDataGrid with refresh

2009-10-21 Thread vam6981

You can extend the AdvancedDataGridGroupItemRenderer and add checkbox in the 
createChildren()

http://vam1021.webs.com/ADGPanel/srcview/source/commongrid/ADGGroupItemRenderer.as.html

Check out my blog http://flexingflashing.blogspot.com/

--- In flexcoders@yahoogroups.com, ibo power...@... wrote:

 Hi just a follow up question,
 
 Is there any way I could also hide the group labels? the filter successfully 
 hides the items but not the
 group labels. If a group, for example has two associated children, when i 
 take out the children, the
 group label should go as well.
 
 second, had anyone here tried extending advanceddatagrid to create some sort 
 of groupLabelRenderer? :)
 I wanna add a checkbox beside the group label.
 
 
 
 
 
 From: Vijay Anand Mareddy v...@...
 To: flexcoders@yahoogroups.com
 Sent: Tuesday, November 4, 2008 10:02:26 PM
 Subject: [flexcoders] Re: updating display of GroupingCollection on 
 AdvancedDataGrid with refresh
 
 
 450 rows shouldnt take so long unless u have summaryfunction and labelfunc 
 etc.
 First check  the performance by removing the SummaryFunction
 
 Here is an example on filtering:
 http://flexpearls. blogspot. com/2008/ 02/groupingcolle ction-to- 
 group-mails- on.html
 
 If all else fails you might want to try Async refresh ...GroupingCollecti 
 on.refresh( false);
 http://flexpearls. blogspot. com/2007/ 10/async- refresh-of- groupingcollecti 
 on.html
 
 --- In flexcod...@yahoogro ups.com, poweribo poweribo@ . wrote:
 
  Hi All,
  
  I have an AdvancedDataGrid, a GroupingCollection and an 
  ArrayCollection as a source of GroupingCollection. 
  
  I update the display by setting a filter on arraycollection and 
  calling refresh. But the AdvancedDataGrid doesnt reflect the changes 
  unless I call GroupingCollection. refresh() . Bad.
  
  My ArrayCollection contains only 450+ items but 
  GroupingCollection. refresh() takes too long time to re-render the 
  list.
  
  Is there any other way that I can do this faster? and without waiting 
  and repopulating the WHOLE list? for example I just want to hide 1 
  item by adding it on my filter, the list should simply adjust by 
  deleting that row only (just like how a normal List 
  UIComp+ArrayCollect ion behaves). Any ideas?
  
  -Stephen
  
  p.s. I have seen the 
  http://flexpearls. blogspot. com/2008/ 06/groupingcolle ction-with- some-
  better.html but it still re-draw the whole thing and doesnt keep the 
  state of the list (expanded/collapsed ).
 





[flexcoders] Re: filtering advanced datagrid

2009-10-21 Thread vam6981
There is an example here with ADG filtering
http://flexingflashing.blogspot.com/

--- In flexcoders@yahoogroups.com, valdhor valdhorli...@... wrote:

 This article should help:
 
 http://jonathanbranam.net/solutions/filter-hierarchicalcollectionview-parent-child-data
 
 and possibly this one:
 
 http://jonathanbranam.net/flex3anatomy/class/HierarchicalCollectionView
 
 
 
 --- In flexcoders@yahoogroups.com, kaushal.shah05 kshah0097@ wrote:
 
  Here is the link to the app:
  
  http://s256908546.onlinehome.us/advgrid/advgridfilter.html
  
  
  --- In flexcoders@yahoogroups.com, kaushal.shah05 kshah0097@ wrote:
  
   how do you filter an advanced datagrid?   I've tried myself with no luck. 
I can only get filter the fist node in the tree.
   
   there are not too many resources out there for the Flex adv datagrid.  
   Adobe should really focus on it as it's always a requirement in the 
   corporate world.
   
   (This is the modified code copied from Sameer's site.)
   
   
   ?xml version=1.0 encoding=utf-8?
   mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
   layout=absolute
   applicationComplete=init()
   mx:Script
   ![CDATA[
   import mx.controls.advancedDataGridClasses.AdvancedDataGridColumn;
   import mx.collections.GroupingField;
   import mx.collections.Grouping;
   import mx.collections.ArrayCollection ;
   import mx.collections.GroupingCollection;
   
   
   public function init() : void {
   flatData.filterFunction = myFilter;
   }
   public function myFilter(item:Object) : Boolean {
   var pattern:String = '.*' + search.text + '.*';
   
   if (item.hasOwnProperty('Territory')) {
if (item.Territory.match(pattern)) {
   return true;
   } else {
   return false;
   }
   }
   return true;
   }
   
   public function updateFilter() : void { 
   groupedData.refresh();
   }
   
   [Bindable] private var flatData:ArrayCollection = new
   ArrayCollection(
   [
   
   { Territory:Nevada, Territory_Rep:Barbara 
   Jennings,Estimate:4 , Actual:38865 },
   { Territory:Nevada, Territory_Rep:Dana Binn ,Estimate:3 , 
   Actual:29885 },
   { Territory:Nevada, Territory_Rep:Joe Schmoe ,Estimate:3 
   , Actual:29134 },
   { Territory:Northern California , Territory_Rep:Lauren Ipsum 
   , Estimate:4 , Actual:38805 },
   { Territory:Northern California , Territory_Rep: T.R.Smith , 
   Estimate:4 , Actual:55498 },
   { Territory:Southern California , Territory_Rep:Jane Grove, 
   Estimate:45000 , Actual:44913 },
   { Territory:Southern California , Territory_Rep:Alice Treu, 
   Estimate:45000 , Actual:44985 },
   { Territory:Nevada , Territory_Rep:Bethany Pittman 
   ,Estimate:45000 , Actual:52888 } 
   ]);
   
   ]]
   /mx:Script
   mx:HBox
   mx:Label text=Territory /
   mx:TextInput id=search text= 
   change=updateFilter()/
   /mx:HBox
   
   mx:AdvancedDataGrid id=adg
   creationComplete=groupedData.refresh() x= 29.5 y=26 width=555
   height=377
   mx:dataProvider
   mx:GroupingCollection id=groupedData source={flatData} 
   
   mx:Grouping
   mx:GroupingField name=Territory 
   mx:summaries
   mx:SummaryRow summaryPlacement=group
   mx:fields
   mx:SummaryField
   dataField=Estimate operation=SUM label=Budget/
   mx:SummaryField
   dataField=Actual operation=SUM /
   /mx:fields
   /mx:SummaryRow
   /mx:summaries
   /mx:GroupingField
   /mx:Grouping
   /mx:GroupingCollection
   /mx:dataProvider
   mx:columns
   mx:AdvancedDataGridColumn width=200 headerText =
   Territory Rep dataField=Territory_Rep/
   mx:AdvancedDataGridColumn headerText=Budget 
   dataField=Budget/
   mx:AdvancedDataGridColumn headerText = Actual
   dataField=Actual/
   /mx:columns
   /mx:AdvancedDataGrid
   
   /mx:Application
  
 





[flexcoders] Re: Help with AdvancedDataGrid - Urgent

2009-10-21 Thread vam6981
Santosh,
Check out the example here http://flexingflashing.blogspot.com/

--- In flexcoders@yahoogroups.com, Adrian Williams adri...@... wrote:

 Hi Santosh,
 
 Check out GroupingCollection.
 
 Adrian
 
 Santosh Varghese wrote:
   
  Hi,
 
 I am  new to  Flex  development. I wanted to use the 
  AdvancedDataGrid  to  display data in a  tree structure. coming from a 
  remoteobject . The remote object is a java Collections object. I  
  could  read this data and  get into Flex ArrayCollection.  The data in 
  the  ArrayCollection contians complex data structure, which cannot be 
  displayed  directly into AdvancedDataGrid. So i need to  create a 
  seperate ArrayCollection object , which serves as the dataprovider for 
  AdvancedDataGrid. I am not able to create the ArrayCollection in the  
  format AdvancedDataGrid  needed to  display it in a tree structure. 
  Does anybody  have any sample code to share ?.
 
 
  I am not able  to set the  label field(eg : Region and  children) 
  programatically , instead of creating it directly as shown  below.
 
  private var dpHierarchy:ArrayCollection = new ArrayCollection([
{Region:Southwest, children: [
   {Region:Arizona, children: [
  {Territory_Rep:Barbara Jennings, Actual:38865, 
  Estimate:4},
  {Territory_Rep:Dana Binn, Actual:29885, 
  Estimate:3}]}, 
   {Region:Central California, children: [
  {Territory_Rep:Joe Smith, Actual:29134, 
  Estimate:3}]}, 
   {Region:Nevada, children: [
  {Territory_Rep:Bethany Pittman, Actual:52888, 
  Estimate:45000}]}, 
   {Region:Northern California, children: [
  {Territory_Rep:Lauren Ipsum, Actual:38805, 
  Estimate:4},
  {Territory_Rep:T.R. Smith, Actual:55498, 
  Estimate:4}]}, 
   {Region:Southern California, children: [
  {Territory_Rep:Alice Treu, Actual:44985, 
  Estimate:45000},
  {Territory_Rep:Jane Grove, Actual:44913, 
  Estimate:45000}]}
]}
  ]);
 
 
   
  Regards,
  Santosh Varghese
 
 





[flexcoders] Re: Accessing DataProvider from GroupingCollection

2009-10-21 Thread vam6981
Another way is to use recursion

var selectedLeafObj:Object = selectedRow;
while(selectedLeafObj  selectedLeafObj.children){
selectedLeafObj = selectedLeafObj.children[0];
}//while

--- In flexcoders@yahoogroups.com, fumeng5 fume...@... wrote:

 I can do it this way but it seems totally wonky to me:
 
 i override set data():
 var appListData:AdvancedDataGridListData = AdvancedDataGridListData(listData);
 (appListData.owner as AdvancedDataGrid).dataProvider.source.source
 --- In flexcoders@yahoogroups.com, fumeng5 fumeng5@ wrote:
 
  Hi,
  
  I have an AdvancedDataGrid with a Grouping Collection to make my flat data 
  into a hierarchy. 
  
  I also have another column of data next to (on the same level) as the 
  group. I need to access the column data there but I can't and I'm guessing 
  it's because the dataProvider is now restructured and I can't get the data 
  using the dataField anymore. 
  
  Is there another way to access it? 
  
  Thanks for any helpful tips,
  
  Matt
 





[flexcoders] Re: How to add custom sorting to AdvancedDataGrid to worked on grouped Data?

2009-10-21 Thread vam6981
sorting works on grouped data also.
checkout the example here http://vam1021.webs.com/ADGPanel/


--- In flexcoders@yahoogroups.com, golnooshp golnoo...@... wrote:

 Hi,
 I have an advancedDataGrid that I need to add custom sorting to it which 
 overrides the original sort! my sorting should work using a combobox to 
 select ascending and desending from with a sort button! I know this is a bug 
 in flex that its original sorting only works in hierarchical data and not for 
 groupingCollection
 the dataProvider of my grid is a flat data. however, in the UI, the user can 
 add grouping to the AdvancedDataGrid. so I want the sort to work on grouped 
 data! 
 let's say the columns are : country, province, city. population and there is 
 grouping on country and province 
 so the sorting should do the following: 
 1) if the user does a descending sort on country: only unitedStates will go 
 up and Canada will go down.
 2)if the user does a descending sort on province: the order of the grouping 
 of province will change to Quebec, Ontario, British Columbia
 3) if the user does a soring on city: although this is not a grouped column, 
 it should do the sorting on all the cities.
 
 
 Thanks,





[flexcoders] Re: What the heck am I doing wrong with my GroupingCollection?

2009-10-21 Thread vam6981
See if this example resolved your problem http://vam1021.webs.com/ADGPanel/


--- In flexcoders@yahoogroups.com, golnooshp golnoo...@... wrote:

 Hi Mark,
 Can you sort on groups at all? Because I know this is a bug in flex that you 
 actually cannot sort on grouped data! the groups can only be sorted if the 
 original data is a hierarchicalData and not a flatData! 
 I'm having the same problem! my data is flat! and in my UI, user can add 
 grouping to ADG, I want to make a custom sort function to be able to sort my 
 groups! 
 let me know if I underestood your question correctly and we are looking for 
 the same thing! I posted this question on more than 10 websites! hopefully 
 I'll get an answer soon and will share it with you! 
 
 Cheers,
 Golnoosh
 --- In flexcoders@yahoogroups.com, Mark markp.shopping_id@ wrote:
 
  I have an AdvancedDataGrid where I'm trything to display the data in 
  groups.  The column order is as follows -- Person Name, Project, 
  Date, and a few numbered data columns.  I'm tring to sort my data in 
  the order of my columns, Name, Project, Date.  Here's my 
  GroupingCollection:
  
  mx:GroupingCollection id=gcPerson
   mx:grouping
mx:Grouping
 mx:GroupingField id=gfName name=name/
  
 mx:GroupingField id=gfProject name=title
  mx:SummaryRow summaryPlacement=group
   mx:fields
mx:SummaryField operation=COUNT dataField=title/
   /mx:fields
  /mx:SummaryRow
  
  mx:SummaryRow summaryPlacement=last
   mx:fields
mx:SummaryField operation=SUM dataField=projectedHours 
  label=summaryPro /
mx:SummaryField operation=SUM dataField=actualHours 
  label=summary /
   /mx:fields
  /mx:SummaryRow
 /mx:GroupingField
  
/mx:Grouping
   /mx:grouping
  /mx:GroupingCollection
  
  In my ADG it looks good but the date is not sorted.  I used a sort 
  on my ArrayCollection but that didn't do anything to help and when I 
  add another GroupingField for month it just splits it up more than I 
  want.
  
  Sorting Function:
  
  private function handleFilterSearch():void{
  sortA = new Sort();
  
  sortByName = new SortField(name, true, false, false);
  sortByProject = new SortField(title, true, false, false);
  sortByDate = new SortField(month, true, false, false);
  
  sortA.fields=[sortByDate];
  myData2.sort=sortA;
  //refresh
  myData2.refresh();
  gcPerson.refresh();
  }
  
  The GroupingCollection sorts the Project and Name, but what can I do 
  sort the date?
  
  Thanks,
  Mark
 





[flexcoders] Re: What the heck am I doing wrong with my GroupingCollection?

2009-10-21 Thread vam6981
See if this example resolved your problem http://vam1021.webs.com/ADGPanel/


--- In flexcoders@yahoogroups.com, golnooshp golnoo...@... wrote:

 Hi Mark,
 Can you sort on groups at all? Because I know this is a bug in flex that you 
 actually cannot sort on grouped data! the groups can only be sorted if the 
 original data is a hierarchicalData and not a flatData! 
 I'm having the same problem! my data is flat! and in my UI, user can add 
 grouping to ADG, I want to make a custom sort function to be able to sort my 
 groups! 
 let me know if I underestood your question correctly and we are looking for 
 the same thing! I posted this question on more than 10 websites! hopefully 
 I'll get an answer soon and will share it with you! 
 
 Cheers,
 Golnoosh
 --- In flexcoders@yahoogroups.com, Mark markp.shopping_id@ wrote:
 
  I have an AdvancedDataGrid where I'm trything to display the data in 
  groups.  The column order is as follows -- Person Name, Project, 
  Date, and a few numbered data columns.  I'm tring to sort my data in 
  the order of my columns, Name, Project, Date.  Here's my 
  GroupingCollection:
  
  mx:GroupingCollection id=gcPerson
   mx:grouping
mx:Grouping
 mx:GroupingField id=gfName name=name/
  
 mx:GroupingField id=gfProject name=title
  mx:SummaryRow summaryPlacement=group
   mx:fields
mx:SummaryField operation=COUNT dataField=title/
   /mx:fields
  /mx:SummaryRow
  
  mx:SummaryRow summaryPlacement=last
   mx:fields
mx:SummaryField operation=SUM dataField=projectedHours 
  label=summaryPro /
mx:SummaryField operation=SUM dataField=actualHours 
  label=summary /
   /mx:fields
  /mx:SummaryRow
 /mx:GroupingField
  
/mx:Grouping
   /mx:grouping
  /mx:GroupingCollection
  
  In my ADG it looks good but the date is not sorted.  I used a sort 
  on my ArrayCollection but that didn't do anything to help and when I 
  add another GroupingField for month it just splits it up more than I 
  want.
  
  Sorting Function:
  
  private function handleFilterSearch():void{
  sortA = new Sort();
  
  sortByName = new SortField(name, true, false, false);
  sortByProject = new SortField(title, true, false, false);
  sortByDate = new SortField(month, true, false, false);
  
  sortA.fields=[sortByDate];
  myData2.sort=sortA;
  //refresh
  myData2.refresh();
  gcPerson.refresh();
  }
  
  The GroupingCollection sorts the Project and Name, but what can I do 
  sort the date?
  
  Thanks,
  Mark
 





[flexcoders] Re: Display ADG Data Asynch (was: Advanced Datagrid performance)

2009-10-21 Thread vam6981
Checkout my version of GroupingCollection
http://flexingflashing.blogspot.com/

--- In flexcoders@yahoogroups.com, valdhor valdhorli...@... wrote:

 If you have a look at the documentation for GroupingCollection 
 (http://livedocs.adobe.com/flex/3/langref/mx/collections/GroupingCollection.html)
  you see that the refresh method takes a parameter (which is set to false). 
 If you set that parameter to true then the ADG will display asynchronously 
 (ie. As each grouping is completed it will display).
 
 
 HTH
 
 
 
 Steve
 
 
 --- In flexcoders@yahoogroups.com, Adrian Williams adrianw@ wrote:
 
  Hi Valdhor,
  
  When you say set it to display async what do you mean?
  
  Adrian
  
  valdhor wrote:
  
  
   Thousands.
  
   It slows down a lot when you have grouping collections but I set it to 
   display asynchronously so the user sees it updating.
  
   --- In flexcoders@yahoogroups.com 
   mailto:flexcoders%40yahoogroups.com, Scott halo@ wrote:
   
   
   
I'm using the advanced datagrid component to display data from my
Coldfusion server. Realistically, how many records can I load into this
component and still have it function?
   
   
   
Thanks
   
Scott
   
  
  
 





[flexcoders] Re: sorting data on non-grouped field in an advanceddatagrid

2009-10-21 Thread vam6981
The first step for Grouping is to sort on that specific column.
and then put the flat data rows into each bucket.
Now to achieve your objective of sorting on a non-grouped column
First call GC.refresh()  -- sorts on grouped column
Now u need to set the Gc.dataprovider.sort = new Sort(non-grouped colm here)
and then refresh again.

Check out my version of GroupingCollection
http://flexingflashing.blogspot.com/

--- In flexcoders@yahoogroups.com, Maciek Sakrejda msakre...@... wrote:

 I have an ADG (simplified example that reproduces the issue follows). I
 want the data broken down by category, but sorted by value (which is
 *not* grouped) within each category. I thought the way to do this would
 be to set up a ListCollectionView to sort my data, then put a grouping
 collection on top. The GroupingCollection, however, seems to undo the
 ListCollectionView sorting.
 
 Is there a way to achieve this with the AdvancedDataGrid? If I bind
 sortedData to a plain DataGrid (with no grouping), this works as
 expected.
 
 Code follows: (note that within each group, things are *not* sorted by
 value).
 
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
 layout=vertical
 mx:Script
 ![CDATA[
 import mx.collections.SortField;
 import mx.collections.Sort;
 import mx.collections.ListCollectionView;
 import mx.collections.ArrayCollection;
 
 public var myData:ArrayCollection = new ArrayCollection([
 { category: 'foo', value: 4 },
 { category: 'foo', value: 3 },
 { category: 'foo', value: 7 },
 { category: 'bar', value: 2 },
 { category: 'bar', value: 1 },
 { category: 'bar', value: 8 },
 ]);
 
 public var sortedData:ListCollectionView = new
 ListCollectionView(myData);
 
 private function handleAdgInit(e:Event):void {
 var valSort:Sort = new Sort();
 valSort.fields = [ new SortField('category'), new
 SortField('value', false, false, true) ];
 sortedData.sort = valSort;
 sortedData.refresh(); 
 gc.refresh();
 }
 
 ]]
 /mx:Script
 mx:AdvancedDataGrid id=myADG 
 width=100% height=100% allowMultipleSelection=true
 initialize=handleAdgInit(event)
 mx:dataProvider
 mx:GroupingCollection id=gc source={sortedData}
 mx:grouping
 mx:Grouping
 mx:GroupingField name=category/
 /mx:Grouping
 /mx:grouping
 /mx:GroupingCollection
 /mx:dataProvider
 
 mx:columns
 mx:AdvancedDataGridColumn dataField=category/
 mx:AdvancedDataGridColumn dataField=value/
 /mx:columns
/mx:AdvancedDataGrid
 /mx:Application
 
 -- 
 Maciek Sakrejda
 Truviso, Inc.
 http://www.truviso.com