Flex 4 Drop Down List - bound with data service, h

2019-06-02 15:38发布

问题:

I have a drop down list that is bound using an HTTP data service from a database (set up through the wizard, not as a declaration). My drop down list changes the values in my datagrid and I need that "Select One" null value so that users can select everything. Here is my drop down list:

<s:DropDownList id="ddlProducts" width="400" prompt="Select a Product" close="dataGridContentChanging()" creationComplete="ddlProducts_creationCompleteHandler(event)" labelField="Title">  
    <s:dataProvider>  
        <s:AsyncListView list="{GetProductsResult.lastResult}"/>  
   </s:dataProvider>  
</s:DropDownList>

Is there a way to always keep the prompt or to programmatically add a "Select One" to the -1 index of the drop down list?

Any help is apprecitated. Thanks!

回答1:

setup an all value in ur Database
(any number of ways to do: this if you are using a look up table just add it to the table, if you are pulling from your data table put in a union statement)

then handle the the 'All' value (on click) to put in '%' as ur variable in dataprovider