3 Replies Latest reply on Feb 7, 2008 3:58 PM by ntsiii

    DataGridColumn and Button Control

    josh_aries Level 1
      Hi ,
      I have a DataGridcolumn code available in the following url


      http://pastebin.com/f53d74fa1


      I get the following error
      id attribute is not allowed on the root tag of a component.

      How do I set the label property to display N on button click
        • 1. Re: DataGridColumn and Button Control
          Gregory Lafrance Level 6
          When you use the <component> element, you are creating a custom component and cannot use an ID. But within that component "this" should allow your component to refer to itself, and you could refer to it outside the component using the itemRenderer property of the DataGridColumn.
          • 2. Re: DataGridColumn and Button Control
            josh_aries Level 1
            Thanks for the reply.
            I was able to access it using "this" property when I use the Script tags inside the component.

            But Could you please provide me with a sample code of how to access it if I am using the script tags outside the component. I am calling the method on the click using the outerDocument but how do I access the label property of the button.
            • 3. Re: DataGridColumn and Button Control
              ntsiii Level 3
              Ahh, you really don't want do that. Item renderers are ephemeral creatures. You can't count on them existing when you want them.

              Now, a suggestion. Instead of calling the method, have your renderer dispatch an event. For simplicity, have it bubble. Add a listener for it on the main app. Make the method a handler, and in that you can access the Button using the event.target property. From that you can get the label.

              One more possibility: pass the value you want to your method as arguments:
              outerDocument.openAlert(this.label)

              Tracy