2 Replies Latest reply on May 7, 2008 7:48 AM by batelo

    Hslide inside datagrid

    batelo
      Dear Sirs,

      I'm looking a way for insert comportamental scores in a datagrid wich the first column is the students name. My main propose is do it using a HSlider component. The look and feel should be similar to it:

      Student name Comportamental Score
      Anne v-------------------------------
      Marie ----------------v--------------
      John ----------v--------------------
      ... ....
      Name HSlider_n

      I had tryed:
      <mx:DataGridColumn dataField="Score" headerText="Comportmental Score">
      <mx:itemRenderer>
      <mx:Component>

      <mx:HSlider minimum="0" maximum="100">

      </mx:HSlider>
      </mx:Component>
      </mx:itemRenderer>
      </mx:DataGridColumn>

      But no sucess. Did you know a way to do that?

      thanks a lot



        • 1. Re: Hslide inside datagrid
          batelo Level 1
          Dear Sirs:

          In my project I have two components:

          1.MyHSlider

          <?xml version="1.0" encoding="utf-8"?>
          <mx:HSlider xmlns:mx=" http://www.adobe.com/2006/mxml"
          minimum="0"
          maximum="100"
          snapInterval="1" tickInterval="10">
          </mx:HSlider>

          2. MyNumericStepper

          <?xml version="1.0" encoding="utf-8"?>
          <mx:NumericStepper xmlns:mx=" http://www.adobe.com/2006/mxml"
          stepSize="1"
          maximum="50">
          </mx:NumericStepper>

          Problem: In the main.xml (see below) if I call itemEditor="MyNumericStepper" the code works fine. But if I call
          itemEditor="MyHSlider" I found this error message:

          TypeError: Error #1034: Type Coercion failed: cannot convert components::MyHSlider@1c916851 to mx.controls.listClasses.IListItemRenderer.
          at mx.controls::DataGrid/createItemEditor()[E:\dev\3.0.x\frameworks\projects\framework\src\m x\controls\DataGrid.as:3857]
          at mx.controls::DataGrid/itemEditorItemEditBeginHandler()[E:\dev\3.0.x\frameworks\projects\f ramework\src\mx\controls\DataGrid.as:4747]
          at flash.events::EventDispatcher/dispatchEventFunction()
          at flash.events::EventDispatcher/dispatchEvent()
          at mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\co re\UIComponent.as:9051]
          at mx.controls::DataGrid/commitEditedItemPosition()[E:\dev\3.0.x\frameworks\projects\framewo rk\src\mx\controls\DataGrid.as:3676]
          at mx.controls::DataGrid/updateDisplayList()[E:\dev\3.0.x\frameworks\projects\framework\src\ mx\controls\DataGrid.as:1498]
          at mx.controls.listClasses::ListBase/validateDisplayList()[E:\dev\3.0.x\frameworks\projects\ framework\src\mx\controls\listClasses\ListBase.as:3281]
          at mx.managers::LayoutManager/validateDisplayList()[E:\dev\3.0.x\frameworks\projects\framewo rk\src\mx\managers\LayoutManager.as:602]
          at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\3.0.x\frameworks\projects\frame work\src\mx\managers\LayoutManager.as:675]
          at Function/ http://adobe.com/AS3/2006/builtin::apply()
          at mx.core::UIComponent/callLaterDispatcher2()[E:\dev\3.0.x\frameworks\projects\framework\sr c\mx\core\UIComponent.as:8460]
          at mx.core::UIComponent/callLaterDispatcher()[E:\dev\3.0.x\frameworks\projects\framework\src \mx\core\UIComponent.as:8403]

          this is a bug?


          main.xml
          <?xml version="1.0"?>
          <!-- itemRenderers\component\MainNSEditor.mxml -->
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml">

          <mx:Script>
          <![CDATA[
          import mx.collections.ArrayCollection;

          [Bindable]
          private var myDP:ArrayCollection = new ArrayCollection([
          {label1:"Order #2314", quant:3, Sent:true},
          {label1:"Order #2315", quant:3, Sent:false}
          ]);
          ]]>
          </mx:Script>

          <mx:DataGrid id="myDG" dataProvider="{myDP}"
          variableRowHeight="true"
          editable="true" >
          <mx:columns>
          <mx:DataGridColumn dataField="label1"
          headerText="Order #"/>
          <mx:DataGridColumn dataField="quant"
          itemEditor="MyNumericStepper"
          editorDataField="value"/>
          </mx:columns >
          </mx:DataGrid>
          </mx:Application>
          • 2. Re: Hslide inside datagrid
            batelo Level 1
            Anybody can help me, please.