A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: if myText.text == any value in a datagrid column

  1. #1
    Member
    Join Date
    Feb 2009
    Posts
    49

    if myText.text == any value in a datagrid column

    Hey guys, in a simple form, I am trying to achieve what's in my title.

    I have a text box in which you type in a value (number).
    I have a submit button which inserts the value into my data-grid which is populated by a data provider to display that information (ZendAMF).

    For my submit button function I need it to loop through all the values(rows) in a column of my data-grid to check if my text box value is equal to any of the data in the rows for that column. How would I go about doing this?

    I can visualize exactly what I need this function to do; I know I will need to loop through my data-gird and check the values in each row of the column and if any are equal to my text box value but I simply don't have the coding knowledge to do so.

  2. #2
    Senior Member Gohloum's Avatar
    Join Date
    Aug 2002
    Location
    Florida
    Posts
    185
    Go to the underlying data to do this. I assume you have some sort of array collection of objects as your data source?

    Pseudo code:

    if (dataSource[fieldInQuestion] == inputText.text)
    {
    // match found
    }

    If you are binding to XML, it's similar:

    // using text nodes
    if (xmlData.(nodeInQuestion == inputText.text).length() > 0)
    {
    // match found
    }

    // using attributes
    if (xmlData.someNode.(@attributeInQuestion == inputText.text).length() > 0)
    {
    // match found
    }
    The Early Bird may get the worm, but the second mouse to the trap gets the cheese...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center