Link to home
Start Free TrialLog in
Avatar of arigs
arigs

asked on

advanced datagrid problem flex 4

Hi experts,

                       I have a problem that in my application I am using adg with headerrenderers for each column. In headerrenderer I included dropdown menu which is having filter labels and checkboxes.
by default all checkboxes will be checked in initially. when all these labels are checked in initially, if click on any value of that column I am able to show corresponding popup . when i unchecked any filter label in dropdown menu and unchecked any filter label , then i click on any value of that column , I am getting error saying that TypeError: Error #1009: Cannot access a property or method of a null object reference.
                                anyone help me out, thanks in advance.
Avatar of zzynx
zzynx
Flag of Belgium image

Your question is not at all clear to me.
1. Post some code

>> I am getting error saying that TypeError: Error #1009: Cannot access a property or method of a null object reference.
2. Tell us on what line of your code you get this one.

3. Tell us your scenario in a step by step way:

    1. I check that filter
    2. I get that result (as expected)
    3. Now I uncheck that filter label
    4. I get that result while it should be ...
Avatar of arigs
arigs

ASKER

scenario:

1. by default all labels are checked . 2. uncheck any label and close the dropdown editor. 3 now click on any value of  that column. then i am getting error#1009.

code:

protected function messDg_itemClickHandler(event:ListEvent):void
                  {
                        var messageVo:MessageCenterVo = event.itemRenderer.data as MessageCenterVo;
                        if(event.columnIndex == 3 )
                        {
                              if(messageVo.status == "Notices" )
                              {
                                    var statusConstructPopup:StatusConstructWindow = PopUpManager.createPopUp(this,StatusConstructWindow,true) as StatusConstructWindow;
                                    statusConstructPopup.width = this.width;
                                    statusConstructPopup.height = this.height;
                              }else if(messageVo.status == "Complete")
                              {
                                    Alert.show("u r wrong:");
                              }else if(messageVo.status == "Processing")

>> then i am getting error#1009.
On exactly what line of the code you posted?
>> 1. by default all labels are checked
>> 2. uncheck any label and close the dropdown editor.
And maybe a screenshot of this would also help me to understand the situation...
Avatar of arigs

ASKER

below one is the default filter editor .
null-reference.bmp
Avatar of arigs

ASKER

if I close this editor after unchecking any label and then clicking on that column value then i am getting the null reference
>> if I close this editor after unchecking any label and then clicking on that column value then i am getting the null reference
And you get that error on exactly what line of the code you posted?
Avatar of arigs

ASKER

at one of inside if conditions depends on the clicked value(i.e. if value is notices then at notices)
>> at one of inside if conditions depends on the clicked value(i.e. if value is notices then at notices)
So, you mean at this line of code
       if(messageVo.status == "Notices" )

This means that messageVo (or event.itemRenderer.data) is null where you don't expect it to be null.
You'll have to check - where the event is dispatched - that the event's data is filled in correctly.
Avatar of arigs

ASKER

yeah exactly, I am getting data as object when i unchecked label, otherwise i am getting it as messagecenterVo, can u guide me how to handle this?
>> I am getting data as object when i unchecked label, otherwise i am getting it as messagecenterVo
Don't understand what you really mean with that...

>> can u guide me how to handle this?
I'll try. If you provide me as much information as possible.
Avatar of arigs

ASKER

when i am debugging without unchecking the filter labels , i am able to see the data(messagecenterVo).
if i unchecked the filter labels and then clicked on any value of the column, I was not able to see data i.e messagecenterVo is null. in this scenario debugging is taking me to the following point of filtereditor
protected function deactivateHandler(event:Event):void
            {
                  
                  endEdit();
            }

Can you post the complete code of that filtereditor?
Avatar of arigs

ASKER

zzynx:

                Hi, thx for ur time and patience. I fixed it myself, actually it is typecasting fault. thats y it was not able to convert the data to messagecenterVo. Really appreciate ur helping nature, thx a ton.
ASKER CERTIFIED SOLUTION
Avatar of zzynx
zzynx
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial