Professional Web Applications Themes

Datagrid select issue - Macromedia Flex General Discussion

I am using flex builder 2.01 and have been using datagrids for a while now. I have recently ran into a weird situation where I have one datagrid out of three that just will not allow a manual selection. If I set the index to 0 for instance, the initial view of the datagrid shows the first item selected. If I go to select a different item, the first item becomes unselected and no other item can be selected. If I leave the initial state to be no item selected, I can never select an item. All other datagrids are ...

  1. #1

    Default Datagrid select issue

    I am using flex builder 2.01 and have been using datagrids for a while now. I
    have recently ran into a weird situation where I have one datagrid out of three
    that just will not allow a manual selection. If I set the index to 0 for
    instance, the initial view of the datagrid shows the first item selected. If I
    go to select a different item, the first item becomes unselected and no other
    item can be selected. If I leave the initial state to be no item selected, I
    can never select an item. All other datagrids are working fine. I have tried to
    set selectable to true but that didn't help. This is really odd, any assistance
    would be greatly appreciated.

    <mx:DataGrid x="10" y="0" width="608" id="ArchiveProperty"
    dataProvider="{PropArchive}" itemClick="{DeadClick()}" height="248"
    selectedIndex="0">
    <mx:columns>
    <mx:DataGridColumn headerText="Listing #" dataField="ListingNumber"/>
    <mx:DataGridColumn headerText="Create Date" dataField="DateCreate"/>
    <mx:DataGridColumn headerText="Address 1" dataField="ListAddr1"/>
    <mx:DataGridColumn headerText="Address 2" dataField="ListAddr2"/>
    <mx:DataGridColumn headerText="City" dataField="ListCity"/>
    <mx:DataGridColumn headerText="State" dataField="ListState"/>
    </mx:columns>
    </mx:DataGrid>

    Praeter Guest

  2. #2

    Default Re: Datagrid select issue

    Bump
    Praeter Guest

  3. #3

    Default Re: Datagrid select issue

    Can you post your DeadClick function code? That is probably where the problem is coming from.

    Vygo
    Masamune Guest

  4. #4

    Default Re: Datagrid select issue

    The code does nothing it just returns. I actually put that in there to help
    troubleshoot the issue. The problem exists whether I have an itemclick or not.

    public function deadclick():void{
    return;
    }

    Praeter Guest

  5. #5

    Default Re: Datagrid select issue

    Can you show data, just 2-3 rows, in PropArchive?
    atta707 Guest

  6. #6

    Default Re: Datagrid select issue

    I am not certain if you want the raw data or the data structure. So I will do
    my best to answer both. The data is provided from a backend server using
    amfphp. I return the data as an object and assign the proper portion to
    PropArchive:Object. The data I return is "ListingNumber, DateCreate, ListAddr1,
    ListAddr2, ListCity, ListState". The data returned is identical to the data
    used in a fully functional datagrid except this data has a archive bit set and
    the archive bit is not returned it is just used as part of the query. The data
    was actually created by the same application and the archive bit was set
    programaticaly via this application. I hope that answers your question.

    Praeter Guest

  7. #7

    Default Re: Datagrid select issue

    Ok... so I ran with atta707's direction to look at the data. I replaced the
    data source of the broken datagrid with that of the working datagrid seeing the
    structure is the same. To my surprise, the datagrid select worked. I am
    continuing to try and find the difference between the two. The get PropArchive
    is literally a cut and paste of the get PropData and I changed the query string
    from active = true to active = false. I wonder if this is one of those silly
    control string issues? I don't know. :(

    Praeter Guest

  8. #8

    Default Re: Datagrid select issue

    Mmmm... Well the good news is I fixed it. The bad news is I have no clue why it
    fixed it. This particular datagrid is in a different tab in a tabnavigator
    panel. Attached is the expanded working code. On the line:

    <mx:Canvas label="Archived" width="100%" height="100%" id="ArchiveTab">

    I had a click="{GetPropertyArchive()}" to refresh the data on tab selection.
    This was old code that was made unnecessary at a later date but I did not
    remove the code. My guess is the datagrid assumed the characteristics of the
    parent tabnavigator and instead of ... wait that can't be right. If that was
    the case then changing the datasource would not have fixed the select issue
    because the 'click' definition on the tabnavigator still existed. I would
    really like to understand why this mattered so I could avoid this issue in the
    future. Any ideas??


    <mx:Canvas label="Archived" width="100%" height="100%" id="ArchiveTab">
    <mx:DataGrid x="10" y="0" width="608" id="ArchiveProperty"
    dataProvider="{PropArchive}" height="248" selectedIndex="0">
    <mx:columns>
    <mx:DataGridColumn headerText="Listing #" dataField="ListingNumber"/>
    <mx:DataGridColumn headerText="Create Date" dataField="DateCreate"/>
    <mx:DataGridColumn headerText="Address 1" dataField="ListAddr1"/>
    <mx:DataGridColumn headerText="Address 2" dataField="ListAddr2"/>
    <mx:DataGridColumn headerText="City" dataField="ListCity"/>
    <mx:DataGridColumn headerText="State" dataField="ListState"/>
    </mx:columns>
    </mx:DataGrid>
    <mx:Button x="263.5" y="300" label="Reuse Listing"
    click="{UnarchiveListing()}" id="reuse" fontFamily="Verdana"/>
    </mx:Canvas>

    Praeter Guest

  9. #9

    Default Re: Datagrid select issue

    > The bad news is I have no clue why it fixed it.

    Are you sure you don't duplicate rows in your data? Are you using any custom
    renderers?

    try this: add a dummy counter for each row of data with a unique value for
    each row and see if that fixes the problem.

    Custom renderers, if use incorrectly, can also be reason for this problem.

    ATTA

    atta707 Guest

  10. #10

    Default Re: Datagrid select issue

    Folks,

    I had the same problem and that took me about 2 days to figure it out ...
    I remembered that when you have to clone an object, using the ObjectUtil.clone() method call, then you need to have an "uid" property in your object. This property is used
    to distinguish the cloned objects and i tried to apply this schema to the objects in my ArrayCollection that was associated with my DataProvider in my DataGrid, and it worked smoothly ...
    it seems that the DataGrid could not distinguish the objects before and after putting and setting this "uid" property with different values, the DataGrid behaviour went normal.

    Hope this information helps someone in the future ...

    Best Regards,

    Wagner Billa
    Wagner Billa Guest

Similar Threads

  1. DataGrid: How do I select and copy text for a DataGrid cell?
    By mukul in forum Macromedia Flex General Discussion
    Replies: 0
    Last Post: October 12th, 12:08 PM
  2. How can I select items in a datagrid to populate a second datagrid.
    By Eric in forum ASP.NET Data Grid Control
    Replies: 5
    Last Post: August 4th, 12:43 AM
  3. Printing issue - it won't select any printers
    By Mark_McIlmail@adobeforums.com in forum Adobe Indesign Windows
    Replies: 7
    Last Post: July 23rd, 01:43 PM
  4. Select, Edit, Update Issue
    By Michael D. Murphy in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: January 29th, 09:52 PM
  5. Select DISTINCT issue (SQL Expert needed)
    By BP Prgm in forum ASP Database
    Replies: 2
    Last Post: October 2nd, 01:36 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139