Here is a possible workaround:

Instead of clearing the DG (which anyway wouldn't look very nice), what about 
setting it to one single empty column ( that is : GridColumn headerText= " " 
and dataField="_nonExistingField_" ) .  
That way, it still looks like a datagrid, although empty and it probably won't 
break.

What do you think?

Maurice 


-----Message d'origine-----
De : Oleg Konovalov [mailto:[email protected]] 
Envoyé : jeudi 25 juillet 2013 20:12
À : [email protected]
Objet : Re: Building Spark DataGrid dynamically

No, it is Clients code, I can't post it. I am getting data dynamically via 
SOAP, convert it to Vector of Objects, then to ArrayCollection, and pass it to 
Spark DG dataprovider. Datagrid is declared in MXML without any columns.
That's it. But as I said, can't clear that AC. Any idea how to avoid that Null 
Reference?
On Jul 25, 2013 8:16 AM, "Martin Miko" <[email protected]> wrote:

> Could you post a code sample? I've seen many strange things, but you 
> must be doing something really funny there.
>
>
> On Thu, Jul 25, 2013 at 1:39 PM, Oleg Konovalov <[email protected]> wrote:
>
> > Full exception trace with numbers:
> >
> > TypeError: Error #1009: Cannot access a property or method of a null
> object
> > reference.
> >
> >           at
> > spark.components.gridClasses::GridLayout/updateTypicalCellSizes()[E:
> > \ 
> > dev\4.5.1\frameworks\projects\spark\src\spark\components\gridClasses
> > \G
> > ridLayout.as:867]
> >
> >           at
> > spark.components.gridClasses::GridLayout/measure()[E:\dev\4.5.1\fram
> > e
> > works\projects\spark\src\spark\components\gridClasses\GridLayout.as:
> > 44 4]
> >
> >           at
> > spark.components.supportClasses::GroupBase/measure()[E:\dev\4.5.1\fr
> > a 
> > meworks\projects\spark\src\spark\components\supportClasses\GroupBase
> > .a
> > s:1148]
> >
> >           at
> > mx.core::UIComponent/measureSizes()[E:\dev\4.5.1\frameworks\projects
> > \ framework\src\mx\core\UIComponent.as:8496]
> >
> >           at
> > mx.core::UIComponent/validateSize()[E:\dev\4.5.1\frameworks\projects
> > \ framework\src\mx\core\UIComponent.as:8420]
> >
> >           at
> > spark.components::Group/validateSize()[E:\dev\4.5.1\frameworks\proje
> > c ts\spark\src\spark\components\Group.as:1012]
> >
> >           at
> > mx.managers::LayoutManager/validateSize()[E:\dev\4.5.1\frameworks\pr
> > o jects\framework\src\mx\managers\LayoutManager.as:665]
> >
> >           at
> > mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.5.1\fram
> > e works\projects\framework\src\mx\managers\LayoutManager.as:816]
> >
> >           at
> > mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.
> > 5
> > .1\frameworks\projects\framework\src\mx\managers\LayoutManager.as:11
> > 80 ]
> >
> >
> > On Thu, Jul 25, 2013 at 12:17 AM, OmPrakash Muppirala
> > <[email protected]>wrote:
> >
> > > Moving topic to "users" list.
> > >
> > > Oleg, you will get a better response in this forum for questions 
> > > like these.  Please make sure you are subscribed to 
> > > [email protected] see further responses.  You could do so by 
> > > sending an email to [email protected].
> > >
> > > Thanks,
> > > Om
> > >
> > >
> > > On Wed, Jul 24, 2013 at 9:12 PM, Oleg Konovalov 
> > > <[email protected]>
> > wrote:
> > >
> > >> Hi,
> > >>
> > >> I am building a screen with one Static DataGrid and one Dynamic 
> > >> (data comes through SOAP and I do not know the number of columns 
> > >> or their names in advance).
> > >> I also get a list of column names in order from another SOAP call.
> > >>
> > >> That Dynamic DataGrid works (converting data from Vector of 
> > >> Objects to ArrayList of Columns).
> > >>
> > >> I still have a few problems:
> > >>
> > >>
> > >> 1) I need to implement "Clear" of that Dynamic table.
> > >>
> > >> No matter what I tried:
> > >>
> > >> arrayColl=null;
> > >>
> > >> arrayColl.removeAll();
> > >>
> > >> arrayColl = new ArrayCollection();
> > >>
> > >> myDG.dataProvider=null;
> > >>
> > >> myDG.dataProvider=new ArrayCollection();
> > >>
> > >> I am getting NULL reference exception coming from some system code:
> >  if
> > >> (cell.visible)...   where cell is null.
> > >>
> > >> How can I clear that dynamic DG ?
> > >>
> > >>
> > >>
> > >> full exception stack:
> > >>
> > >> TypeError: Error #1009: Cannot access a property or method of a 
> > >> null object reference.
> > >> at 
> > >> spark.components.gridClasses::GridLayout/updateTypicalCellSizes()
> > >> at spark.components.gridClasses::GridLayout/measure()
> > >> at spark.components.supportClasses::GroupBase/measure()
> > >> at mx.core::UIComponent/measureSizes()
> > >> at mx.core::UIComponent/validateSize()
> > >> at spark.components::Group/validateSize()
> > >> at mx.managers::LayoutManager/validateSize()
> > >> at mx.managers::LayoutManager/doPhasedInstantiation()
> > >> at mx.managers::LayoutManager/doPhasedInstantiationCallback()
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >> 2)  It seems that by default that Dynamic DG puts columns in
> > alphabetical
> > >>
> > >> order, which is of course not what I need.
> > >>
> > >> Any way to disable that or fix somehow?
> > >>
> > >>
> > >>
> > >>
> > >> 3) I need to show 2 DGs on the screen, and the second of them is
> > Dynamic,
> > >>
> > >> and allow user to resize them vertically to be able to see more 
> > >> in
> > static
> > >> or dynamic DG.
> > >>
> > >> I put them in VDividedBox (and set height of both DG and 
> > >> container to 100%).
> > >>
> > >> It split the screen vertically 50:50, but still there is no 
> > >> draggable
> in
> > >> between,
> > >>
> > >> so can't resize.
> > >>
> > >>
> > >>
> > >> Any help is very appreciated.
> > >>
> > >>
> > >>
> > >>
> > >> TIA,
> > >>
> > >> Oleg.
> > >>
> > >
> > >
> >
> >
> > --
> > Thank you,
> > Oleg.
> >
>
>
>
> --
> Martin Miko
>

Reply via email to