pre-selecting some rows in a DataGrid

View: New views
2 Messages — Rating Filter:   Alert me  

pre-selecting some rows in a DataGrid

by WillyRay :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hey All,

Here's my current boggle:

I have a datagrid on a form that contains all possible selections.  Say, for
example, I have a pizza order form, and I have all the possible toppings in
a datagrid.

Now, when the user multi-selects the toppings, and submits the order, I'm
capturing the data just fine.  n number of toppings get inserted into the
database.

When I try to "review" the order, I'm sending down a VO from the server that
contains all the form data, plus an ArrayCollection of topping VOs.  I'm
struggling with selecting the correct toppings in the datagrid.

Here's basically what I'm doing...

for (var i:int = 0; i<allToppingsData.length; i++) //loop over the array of
all toppings  {
    for (var j:int=0; j<inputVO.toppings.length; j++)//loop over the
toppings in the VO
    {
    if (allToppings[i].toppingID = inputVO.toppings[j].toppingID)
      {//current topping in the VO matches the topping in the all toppings
list
      toppingDataGrid.selectedItems =
toppingDataGrid.selectedItems.concat(toppingDataGrid.dataprovider[i];
    }
  }

This, unfortunately, isn't worth the paper it's printed on.  Doesn't seem to
work at all.  Anybody got any ideas?

/w


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/flex/message.cfm/messageid:6075
Subscription: http://www.houseoffusion.com/groups/flex/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.37

Re: pre-selecting some rows in a DataGrid

by Douglas Knudsen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Checkout selectedItemsCompareFunction, might help you there.  Also, in your
attempts, I'd build a array of these selectedItems of your own, then set
selectedItems = yourArray at the end.  Each change to selectedItems throws
events.

Look here
http://www.remotesynthesis.com/post.cfm/flex-101-setting-the-selected-items-on-a-flex-list-or-grid


Douglas Knudsen
http://www.cubicleman.com
this is my signature, like it?


On Fri, Sep 4, 2009 at 12:24 PM, Willy Ray <willyray@...> wrote:

>
> Hey All,
>
> Here's my current boggle:
>
> I have a datagrid on a form that contains all possible selections.  Say,
> for
> example, I have a pizza order form, and I have all the possible toppings in
> a datagrid.
>
> Now, when the user multi-selects the toppings, and submits the order, I'm
> capturing the data just fine.  n number of toppings get inserted into the
> database.
>
> When I try to "review" the order, I'm sending down a VO from the server
> that
> contains all the form data, plus an ArrayCollection of topping VOs.  I'm
> struggling with selecting the correct toppings in the datagrid.
>
> Here's basically what I'm doing...
>
> for (var i:int = 0; i<allToppingsData.length; i++) //loop over the array of
> all toppings  {
>    for (var j:int=0; j<inputVO.toppings.length; j++)//loop over the
> toppings in the VO
>    {
>    if (allToppings[i].toppingID = inputVO.toppings[j].toppingID)
>      {//current topping in the VO matches the topping in the all toppings
> list
>      toppingDataGrid.selectedItems =
> toppingDataGrid.selectedItems.concat(toppingDataGrid.dataprovider[i];
>    }
>  }
>
> This, unfortunately, isn't worth the paper it's printed on.  Doesn't seem
> to
> work at all.  Anybody got any ideas?
>
> /w
>
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/flex/message.cfm/messageid:6076
Subscription: http://www.houseoffusion.com/groups/flex/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.37