You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Oleg Konovalov <ol...@gmail.com> on 2013/08/01 00:19:22 UTC

RE: Building Spark DataGrid dynamically

Prabhu,

That was very useful.

Also how can I do Validation on some of these dynamic fields,
like user should not be able to enter Alphanumeric if that is an Integer
field.

Please advice.

TIA,
Oleg
On Jul 26, 2013 2:15 AM, "Prabu Moorthy" <Pr...@symphonyteleca.com>
wrote:

> Below code render datagrid columns in original order,
>
> var colArr:ArrayList = new ArrayList();
> var colNames:Array=//Assign list of Datagrid column names
> var len:int = colNames.length;
> for(var i:int=0;i<len;i++)
> {
>         var gc:GridColumn = new GridColumn(colNames [i]);
>         colArr.addItem(gc);
> }
> dg.columns = colArr; //dg is mxml datagrid id
> dg.dataProvider = dgAC;//Assign Datagrid arrayCollection data
>
>
> Thanks & Regards
> M.Prabhu
>
> -----Original Message-----
> From: Oleg Konovalov [mailto:olegkon@gmail.com]
> Sent: Friday, July 26, 2013 6:51 AM
> To: users@flex.apache.org
> Subject: Re: Building Spark DataGrid dynamically
>
> Yes, it fixed that exception:   arrCol.source=new Array( { "" : ""} );
>
> Any suggestions how to resolve items 2 & 3 (show columns in original order
> and implement VDividerBox when second datagrid populated dynamically) ?
>
>
> On Thu, Jul 25, 2013 at 2:21 PM, Maurice Amsellem <
> maurice.amsellem@systar.com> wrote:
>
> > 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:olegkon@gmail.com]
> > Envoyé : jeudi 25 juillet 2013 20:12
> > À : users@flex.apache.org
> > 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" <ma...@gmail.com> 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 <ol...@gmail.com>
> > 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
> > > > <bi...@gmail.com>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
> > > > > users@flex.apache.orgto see further responses.  You could do so by
> > > > > sending an email to users-subscribe@flex.apache.org.
> > > > >
> > > > > Thanks,
> > > > > Om
> > > > >
> > > > >
> > > > > On Wed, Jul 24, 2013 at 9:12 PM, Oleg Konovalov
> > > > > <ol...@gmail.com>
> > > > 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
> > >
> >
>
>
>
> --
> Thank you,
> Oleg.
>