[flexcoders] AdvancedDataGrid: last row disappears on click

2010-08-16 Thread charliecrystle
I'm about a 9-month Flex programmer; this issue is hampering progress and I've
tested it a bunch:

I have an ADG, with a 1-item ArrayCollection. Both the ADG and AC are
instantiated in actionscript.

The ADG displays the single row with its data--that's correct. When ADG.editable
is set to false, there is no issue.

When ADG.editable is set to true or item, etc, it throws an error when I
click on the row:

TypeError: Error #1010: A term is undefined and has no properties.
at
mx.controls::AdvancedDataGridBaseEx/commitEditedItemPosition()[E:\dev\4.x\framew\
orks\projects\datavisualization\src\mx\controls\AdvancedDataGridBaseEx.as:4854]

That row is this:
var partialRow:int = (rowInfo[listItems.length - 1].y + rowInfo[listItems.length
- 1].height  listContent.height) ? 1 : 0;

and the listItems.length is 0, which obviously causes the error, but which is
also not intended given there's an item in the original AC.

When I add multiple rows, no error is thrown when I click to edit the last row;
instead, the last row just disappears.

If I attach an itemRenderer to the column, the last row still disappears, but
the issue with the single row goes away.

col1.itemRenderer= new ClassFactory(cdc.CellField); where TextInput is set to
editable=true;

I think I've narrowed it down to the listItems issue, but I don't know how to
dig further to stop the last row from disappearing on click.

Can you help?




[flexcoders] Re: ALEX: AdvancedDataGrid: last row disappears on click

2010-08-16 Thread charliecrystle
no--not yet. 

should I post code?

--- In flexcoders@yahoogroups.com, Alex Harui aha...@... wrote:

 Do you have any logic that deletes items from the AC?  I'd be checking to see 
 if that code is somehow running.
 
 
 On 8/15/10 9:31 AM, charliecrystle charlie.crys...@... wrote:
 
 
 
 
 
 
 I'm about a 9-month Flex programmer; this issue is hampering progress and 
 I've tested it a bunch:
 
 I have an ADG, with a 1-item ArrayCollection. Both the ADG and AC are 
 instantiated in actionscript.
 
 The ADG displays the single row with its data--that's correct. When 
 ADG.editable is set to false, there is no issue.
 
 When ADG.editable is set to true or item, etc, it throws an error when I 
 click on the row:
 
 TypeError: Error #1010: A term is undefined and has no properties.
 at 
 mx.controls::AdvancedDataGridBaseEx/commitEditedItemPosition()[E:\dev\4.x\frameworks\projects\datavisualization\src\mx\controls\AdvancedDataGridBaseEx.as:4854]
 
 That row is this:
 var partialRow:int = (rowInfo[listItems.length - 1].y + 
 rowInfo[listItems.length - 1].height  listContent.height) ? 1 : 0;
 
 and the listItems.length is 0, which obviously causes the error, but which is 
 also not intended given there's an item in the original AC.
 
 When I add multiple rows, no error is thrown when I click to edit the last 
 row; instead, the last row just disappears.
 
 If I attach an itemRenderer to the column, the last row still disappears, but 
 the issue with the single row goes away.
 
 col1.itemRenderer= new ClassFactory(cdc.CellField); where TextInput is set to 
 editable=true;
 
 I think I've narrowed it down to the listItems issue, but I don't know how to 
 dig further to stop the last row from disappearing on click.
 
 Can you help?
 
 
 
 
 
 
 --
 Alex Harui
 Flex SDK Team
 Adobe System, Inc.
 http://blogs.adobe.com/aharui





[flexcoders] ALEX: AdvancedDataGrid: last row disappears on click

2010-08-15 Thread charliecrystle
I'm about a 9-month Flex programmer; this issue is hampering progress and I've 
tested it a bunch:

I have an ADG, with a 1-item ArrayCollection. Both the ADG and AC are 
instantiated in actionscript. 

The ADG displays the single row with its data--that's correct. When 
ADG.editable is set to false, there is no issue.  

When ADG.editable is set to true or item, etc, it throws an error when I 
click on the row:

TypeError: Error #1010: A term is undefined and has no properties.
at 
mx.controls::AdvancedDataGridBaseEx/commitEditedItemPosition()[E:\dev\4.x\frameworks\projects\datavisualization\src\mx\controls\AdvancedDataGridBaseEx.as:4854]

That row is this:
var partialRow:int = (rowInfo[listItems.length - 1].y + 
rowInfo[listItems.length - 1].height  listContent.height) ? 1 : 0;

and the listItems.length is 0, which obviously causes the error, but which is 
also not intended given there's an item in the original AC. 

When I add multiple rows, no error is thrown when I click to edit the last row; 
instead, the last row just disappears. 

If I attach an itemRenderer to the column, the last row still disappears, but 
the issue with the single row goes away. 

col1.itemRenderer= new ClassFactory(cdc.CellField); where TextInput is set to 
editable=true;

I think I've narrowed it down to the listItems issue, but I don't know how to 
dig further to stop the last row from disappearing on click.  

Can you help?



[flexcoders] Clearing datasource for ADG/ArrayCollection/ Getting unwanted Duplicates

2010-02-11 Thread charliecrystle
Hi--I populate an ADG from a SQLite database. Works great. 

But I when I add a record, I want to repopulate the ADG with the data I just 
added, so I call the query function again, populate the ArrayCollection with 
result.data, and refresh the ADG. 

My AC is goalsAC. I tried goalsAC.removeAll(), but that doesn't work (reported 
bug, apparently). 

Here's the relevant code--you can see I'm trying anything to clear out the 
arraycollection. Doesn't do the job:

 gc.source=null; //gc is the MXML group collection in the ADG
 goalsAC.source=new Array(); //goalsAC is the arraycollection
 goalsAC=null;
 goalsAC=new ArrayCollection(result.data)//result.data is SQLResults

if (result.data != null)
 {var numRows:int = result.data.length;
for (var i:int = 0; i  numRows; i++) 
{
var row:Object = goalsAC.source[i];
goalsAC.addItem(row); //adding rows from the 
}
   }

can anyone help? thanks!



[flexcoders] Re: Clearing datasource for ADG/ArrayCollection/ Getting unwanted Duplicates

2010-02-11 Thread charliecrystle
bump

--- In flexcoders@yahoogroups.com, charliecrystle charlie.crys...@... wrote:

 Hi--I populate an ADG from a SQLite database. Works great. 
 
 But I when I add a record, I want to repopulate the ADG with the data I just 
 added, so I call the query function again, populate the ArrayCollection with 
 result.data, and refresh the ADG. 
 
 My AC is goalsAC. I tried goalsAC.removeAll(), but that doesn't work 
 (reported bug, apparently). 
 
 Here's the relevant code--you can see I'm trying anything to clear out the 
 arraycollection. Doesn't do the job:
 
  gc.source=null; //gc is the MXML group collection in the ADG
  goalsAC.source=new Array(); //goalsAC is the arraycollection
  goalsAC=null;
  goalsAC=new ArrayCollection(result.data)//result.data is SQLResults
 
 if (result.data != null)
  {var numRows:int = result.data.length;
 for (var i:int = 0; i  numRows; i++) 
   {
   var row:Object = goalsAC.source[i];
   goalsAC.addItem(row); //adding rows from the 
   }
}
 
 can anyone help? thanks!





[flexcoders] Re: Problem losing values from query results to RESULT.DATA

2010-01-20 Thread charliecrystle
fixed--issue was COUNT. Select COUNT(*) fixed the issue...

--- In flexcoders@yahoogroups.com, Tim Romano tim_rom...@... wrote:

 What happens if you don't put any quotes around the column aliases?
 Tim
 
 On 1/19/2010 4:55 PM, charliecrystle wrote:
 
  Weird issue:
 
  I have a query that works fine--produces expected results:
  SELECT COUNT(tagsLU.tagid) as 'tagcount', tag.tagname as 'tagname' 
  FROM TagsLU Inner Join tag on tag.tagid=tagslu.tagid Group By 
  tag.tagname Order By tagcount DESC
 





[flexcoders] Re: Problem losing values from query results to RESULT.DATA

2010-01-20 Thread charliecrystle
thanks--same result. 

--- In flexcoders@yahoogroups.com, Tim Romano tim_rom...@... wrote:

 What happens if you don't put any quotes around the column aliases?
 Tim
 
 On 1/19/2010 4:55 PM, charliecrystle wrote:
 
  Weird issue:
 
  I have a query that works fine--produces expected results:
  SELECT COUNT(tagsLU.tagid) as 'tagcount', tag.tagname as 'tagname' 
  FROM TagsLU Inner Join tag on tag.tagid=tagslu.tagid Group By 
  tag.tagname Order By tagcount DESC
 





[flexcoders] SQL COUNT AIR ISSUE (solved)

2010-01-20 Thread charliecrystle
I had a nasty problem that cost me 5 hours. 5 Baffling hours. Life of a newbie.

I wanted to retrieve a simple COUNT from a table, group it by a field tagname 
and display the count of each tagname. I have a number of queries with COUNT 
that work fine. But not this time.

AIR would return zero for each tagname. Here's the query:
SELECT COUNT(tagsLU.tagid) as 'tagcount', tag.tagname as 'tagname' FROM TagsLU
Inner Join tag on tag.tagid=tagslu.tagid Group By tag.tagname Order By tagcount
DESC
Here's the expected result, which SQLITE gives me quite generously:

COUNT | TAGNAME
5 school
4 volunteer
2 casual
2 family
1 house
1 work

Except when I called the query from my Flex app, AIR transforms the numbers to 
zero. Big fat 0. I tested and tested, converted the results to an array, tested 
more, and still no luck. Hours. 

I fixed the problem by changing the query. 

While SQLITE is cool with that COUNT(fieldname) statement, AIR doesn't like it. 

But it likes COUNT(*).

SELECT COUNT(*) as 'tagcount', tag.tagname as 'tagname' FROM TagsLU Inner Join 
tag on tag.tagid=tagslu.tagid Group By tag.tagname Order By tagcount DESC

So back to the grind. I hope this helps any other newbies out there.



[flexcoders] Problem losing values from query results to RESULT.DATA

2010-01-19 Thread charliecrystle
Weird issue: 

I have a query that works fine--produces expected results:
SELECT COUNT(tagsLU.tagid) as 'tagcount', tag.tagname as 'tagname' FROM TagsLU 
Inner Join tag on tag.tagid=tagslu.tagid Group By tag.tagname Order By tagcount 
DESC

which produces an array like this:

5 school
4 volunteer
2 casual
2 family
1 house
1 work

HOWEVER, when I retrieve through AS3 and run a trace, I get this:

 tag: casual; tagcount: 0
 tag: family; tagcount: 0
 tag: housework; tagcount: 0
 tag: school; tagcount: 0
 tag: volunteer; tagcount: 0
 tag: work; tagcount: 0

Here's the trace code:
...
var result:SQLResult = tagsStmt.getResult();
var numResults:int=result.data.length

for (var i:int = 0; i  numResults; i++) 
{ 
var row:Object = result.data[i]; 
var output:String = tag:  + row.tagname; 
output += ; tagcount:  + row.tagcount; 
trace(output); 
} 

Any thoughts? I'm sooo close to finishing :)