2 Replies Latest reply on Dec 30, 2008 9:19 PM by Pavan Neeli

    selectedItem property is not working when filter applied for dataprovider(for Datagrid)

    Pavan Neeli Level 1
      Hi,
      I am using a datagrid with 2 columns(one is checkbox, using an itemrenderer)

      I have a callback function for check event in checkbox.
      in this method, I generally get selected itenm with below code
      var selectedObject:ElementRecord = ElementRecord(stageDataGrid.selectedItem);
      if (selectedObject != null){
      ..
      }


      I am also having a filter functionality in the dataprovider(which is ArrayCollection)
      as below
      .
      if (search.text != ""){
      stageGridData.filterFunction = searchData;
      stageGridData.refresh();
      stageDataGrid.dataProvider = stageGridData;
      .
      .
      }
      this filter will work when we enter some text in a text filed.

      Problem is when I don't have any value in text filed(so no filtering would be), then when I check(checkbox) a item in datagrid, I am able to get the selected object, and proceeding for furthur logic.

      but when I have a filter text, where filter functionality would work, and then only some of the entries would be exist in datagrid(which satisfies the text in filter text filed), and then when I check(checkbox) any of the entries, then I am getting null as selected object.


      Could you please let me know what would be an issue here


      Thansk in advance.

      Regards
      Pavan Neeli