You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by mark goldin <ma...@gmail.com> on 2015/08/03 19:59:30 UTC

DataProviders and binding

This is a typical code to set a dataprovider:
public function set dataProvider(value:Object):void
{
if (value)
{
grid.dataProvider = value;
}
}
Execution gets into this code twice. First when value is null, and second
when it's not null. Well, it's not null but still has no data. Is it
possible to only assign a data provider when there are actual rows? The
reason I am thinking of doing it is because I want to add a column to
dataProvider from another arrayCollection.

Any idea?

Thanks

Re: DataProviders and binding

Posted by Alex Harui <ah...@adobe.com>.
Well, you could try a binding expression like

{ dp.length == 0 ? null : dp }

On 8/3/15, 10:59 AM, "mark goldin" <ma...@gmail.com> wrote:

>This is a typical code to set a dataprovider:
>public function set dataProvider(value:Object):void
>{
>if (value)
>{
>grid.dataProvider = value;
>}
>}
>Execution gets into this code twice. First when value is null, and second
>when it's not null. Well, it's not null but still has no data. Is it
>possible to only assign a data provider when there are actual rows? The
>reason I am thinking of doing it is because I want to add a column to
>dataProvider from another arrayCollection.
>
>Any idea?
>
>Thanks