You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@royale.apache.org by Gabe Harbs <ha...@gmail.com> on 2018/01/25 22:18:33 UTC

DropDownList with ArrayList

The dataProvider setter in DropDownList has the following code:

                for (i = 0; i < n; i++) {
                    opt = document.createElement('option') as HTMLOptionElement;
                    if (lf)
                        opt.text = value[i][lf];
                    else
                        opt.text = value[i];
                    dd.add(opt, null);
                }

Basically, it makes the assumption that the dataProvider is an index-accessible object. This is not the case if the dataProvider is a collection. In that case, the code should be something like this:

                        opt.text = value.getItemAt(i)[lf];
                    else
                        opt.text = value.getItemAt(i);

I’m not sure of the best way to generalize this.

Thoughts?
Harbs

Re: DropDownList with ArrayList

Posted by Gabe Harbs <ha...@gmail.com>.
Yup. And an Express version should probably use a bead which can handle either Array or ICollection dataProviders.

> On Jan 26, 2018, at 3:32 PM, Peter Ent <pe...@adobe.com.INVALID> wrote:
> 
> In PAYG fashion we/you would need to create a new set of beads that work
> with ICollectionView rather than generalizing.
> 
> ‹peter
> 
> On 1/25/18, 5:36 PM, "Gabe Harbs" <ha...@gmail.com> wrote:
> 
>> Yeah. Maybe. In my case, I just used Array instead of ArrayList, but that
>> shouldn¹t really be necessaryŠ
>> 
>>> On Jan 26, 2018, at 12:29 AM, Piotr Zarzycki
>>> <pi...@gmail.com> wrote:
>>> 
>>> Hi Harbs,
>>> 
>>> I've looked couple of times into the DropDownList from Basic. Maybe it's
>>> time to reorganize things. Add there View, Model, Renderers etc ? I did
>>> that for MDL DropDownList.
>>> 
>>> Thanks, Piotr
>>> 
>>> 2018-01-25 23:18 GMT+01:00 Gabe Harbs <ha...@gmail.com>:
>>> 
>>>> The dataProvider setter in DropDownList has the following code:
>>>> 
>>>>               for (i = 0; i < n; i++) {
>>>>                   opt = document.createElement('option') as
>>>> HTMLOptionElement;
>>>>                   if (lf)
>>>>                       opt.text = value[i][lf];
>>>>                   else
>>>>                       opt.text = value[i];
>>>>                   dd.add(opt, null);
>>>>               }
>>>> 
>>>> Basically, it makes the assumption that the dataProvider is an
>>>> index-accessible object. This is not the case if the dataProvider is a
>>>> collection. In that case, the code should be something like this:
>>>> 
>>>>                       opt.text = value.getItemAt(i)[lf];
>>>>                   else
>>>>                       opt.text = value.getItemAt(i);
>>>> 
>>>> I¹m not sure of the best way to generalize this.
>>>> 
>>>> Thoughts?
>>>> Harbs
>>> 
>>> 
>>> 
>>> 
>>> -- 
>>> 
>>> Piotr Zarzycki
>>> 
>>> Patreon: 
>>> *https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pat
>>> reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com%7C724d30423d3844
>>> 1d3d2208d564441339%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636525165
>>> 903100864&sdata=ZkXTZnuXlNS%2BK3mWSES4ZO2l8BJWRepVkMgxes4FbNM%3D&reserved
>>> =0
>>> 
>>> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pat
>>> reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com%7C724d30423d3844
>>> 1d3d2208d564441339%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636525165
>>> 903100864&sdata=ZkXTZnuXlNS%2BK3mWSES4ZO2l8BJWRepVkMgxes4FbNM%3D&reserved
>>> =0>*
>> 
> 


Re: DropDownList with ArrayList

Posted by Peter Ent <pe...@adobe.com.INVALID>.
In PAYG fashion we/you would need to create a new set of beads that work
with ICollectionView rather than generalizing.

‹peter

On 1/25/18, 5:36 PM, "Gabe Harbs" <ha...@gmail.com> wrote:

>Yeah. Maybe. In my case, I just used Array instead of ArrayList, but that
>shouldn¹t really be necessaryŠ
>
>> On Jan 26, 2018, at 12:29 AM, Piotr Zarzycki
>><pi...@gmail.com> wrote:
>> 
>> Hi Harbs,
>> 
>> I've looked couple of times into the DropDownList from Basic. Maybe it's
>> time to reorganize things. Add there View, Model, Renderers etc ? I did
>> that for MDL DropDownList.
>> 
>> Thanks, Piotr
>> 
>> 2018-01-25 23:18 GMT+01:00 Gabe Harbs <ha...@gmail.com>:
>> 
>>> The dataProvider setter in DropDownList has the following code:
>>> 
>>>                for (i = 0; i < n; i++) {
>>>                    opt = document.createElement('option') as
>>> HTMLOptionElement;
>>>                    if (lf)
>>>                        opt.text = value[i][lf];
>>>                    else
>>>                        opt.text = value[i];
>>>                    dd.add(opt, null);
>>>                }
>>> 
>>> Basically, it makes the assumption that the dataProvider is an
>>> index-accessible object. This is not the case if the dataProvider is a
>>> collection. In that case, the code should be something like this:
>>> 
>>>                        opt.text = value.getItemAt(i)[lf];
>>>                    else
>>>                        opt.text = value.getItemAt(i);
>>> 
>>> I¹m not sure of the best way to generalize this.
>>> 
>>> Thoughts?
>>> Harbs
>> 
>> 
>> 
>> 
>> -- 
>> 
>> Piotr Zarzycki
>> 
>> Patreon: 
>>*https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pat
>>reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com%7C724d30423d3844
>>1d3d2208d564441339%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636525165
>>903100864&sdata=ZkXTZnuXlNS%2BK3mWSES4ZO2l8BJWRepVkMgxes4FbNM%3D&reserved
>>=0
>> 
>><https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pat
>>reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com%7C724d30423d3844
>>1d3d2208d564441339%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636525165
>>903100864&sdata=ZkXTZnuXlNS%2BK3mWSES4ZO2l8BJWRepVkMgxes4FbNM%3D&reserved
>>=0>*
>


Re: DropDownList with ArrayList

Posted by Gabe Harbs <ha...@gmail.com>.
Yeah. Maybe. In my case, I just used Array instead of ArrayList, but that shouldn’t really be necessary…

> On Jan 26, 2018, at 12:29 AM, Piotr Zarzycki <pi...@gmail.com> wrote:
> 
> Hi Harbs,
> 
> I've looked couple of times into the DropDownList from Basic. Maybe it's
> time to reorganize things. Add there View, Model, Renderers etc ? I did
> that for MDL DropDownList.
> 
> Thanks, Piotr
> 
> 2018-01-25 23:18 GMT+01:00 Gabe Harbs <ha...@gmail.com>:
> 
>> The dataProvider setter in DropDownList has the following code:
>> 
>>                for (i = 0; i < n; i++) {
>>                    opt = document.createElement('option') as
>> HTMLOptionElement;
>>                    if (lf)
>>                        opt.text = value[i][lf];
>>                    else
>>                        opt.text = value[i];
>>                    dd.add(opt, null);
>>                }
>> 
>> Basically, it makes the assumption that the dataProvider is an
>> index-accessible object. This is not the case if the dataProvider is a
>> collection. In that case, the code should be something like this:
>> 
>>                        opt.text = value.getItemAt(i)[lf];
>>                    else
>>                        opt.text = value.getItemAt(i);
>> 
>> I’m not sure of the best way to generalize this.
>> 
>> Thoughts?
>> Harbs
> 
> 
> 
> 
> -- 
> 
> Piotr Zarzycki
> 
> Patreon: *https://www.patreon.com/piotrzarzycki
> <https://www.patreon.com/piotrzarzycki>*


Re: DropDownList with ArrayList

Posted by Piotr Zarzycki <pi...@gmail.com>.
Hi Harbs,

I've looked couple of times into the DropDownList from Basic. Maybe it's
time to reorganize things. Add there View, Model, Renderers etc ? I did
that for MDL DropDownList.

Thanks, Piotr

2018-01-25 23:18 GMT+01:00 Gabe Harbs <ha...@gmail.com>:

> The dataProvider setter in DropDownList has the following code:
>
>                 for (i = 0; i < n; i++) {
>                     opt = document.createElement('option') as
> HTMLOptionElement;
>                     if (lf)
>                         opt.text = value[i][lf];
>                     else
>                         opt.text = value[i];
>                     dd.add(opt, null);
>                 }
>
> Basically, it makes the assumption that the dataProvider is an
> index-accessible object. This is not the case if the dataProvider is a
> collection. In that case, the code should be something like this:
>
>                         opt.text = value.getItemAt(i)[lf];
>                     else
>                         opt.text = value.getItemAt(i);
>
> I’m not sure of the best way to generalize this.
>
> Thoughts?
> Harbs




-- 

Piotr Zarzycki

Patreon: *https://www.patreon.com/piotrzarzycki
<https://www.patreon.com/piotrzarzycki>*