Renderers

Hi friends,
Any easy to understand examples on renderers.
Like adding new rows with delete button, select all or select individual lines, auto resizeable text boxes.
Any help would be appreciated.         
Regards,
Mahee

Here is an exmaple of on itemgrid renderer. You can use insted of a button what ever you want (checkbox, combobox etc).
<?xml version="1.0" encoding="utf-8"?>
<mx:Button xmlns:mx="http://www.adobe.com/2006/mxml" width="128" label="Print" click="deleteManifest()">
    <mx:Script>
        <![CDATA[
            import mx.rpc.events.ResultEvent;
            import com.crispico.tethys.dto.ManifestDto;
            import com.crispico.tethys.dto.ShipmentDto;
            import mx.controls.Spacer;
            import mx.containers.ControlBar;
            import mx.controls.TextInput;
            import mx.controls.DataGrid;
            import mx.controls.Label;
            import mx.containers.HBox;
            import mx.containers.VBox;
            import mx.managers.PopUpManager;
            import mx.containers.Panel;
            import mx.controls.Alert;
            import mx.controls.dataGridClasses.DataGridListData;
             private function deleteManifest():void{
                 var table:DataGrid=DataGrid(this.owner);//this will load your datagrid so you can use it here
                 deleteManifest(table.selectedItem.id);// make an action with the selectedDatagrid   
        ]]>
    </mx:Script> 
</mx:Button>

Similar Messages

  • Is it OK to re-use 1 instance of editors and renderers?

    Hi,
    The simple version of the question, is can I make 1 instance of my custom cell editor and cell renderer classes and safely use it in all my JTable instances?
    For example, I have a DateRenderer class, and instantiate it in a static member, and use it in all Date columns and tables, many of which will be instatiated at one time. If a column needs a non-default format, then I guess I'd create a special instance for it, other wise it would use the default instance.
    It seems to be OK so far, but but my program hasn't received any serious usage yet.
    As to why, I'm thinking this way, I've been messing around with CellEditors and renderers and despite wanting to use default functionality whenver possible, I find that I'm using custom versions for every situation... so if possible, I'd like to keep the number of instances to a minimum.
    Regards
    Iain

    OK, I see what you mean.
    Stop cell editing on focus lost isn't the default behaviour, but I've had to use it anyway (it seems to make sense).
    The reason I asked is that, to get the behaviour that I want, it looks like I'll have to have my custom renderers and editors on every column of every table so I'd like to avoid unneccessary instantiation.
    I'm aiming for a system where:
    - 1 click selects the row (default behaviour),
    - 2 clicks starts editing the cell (also default),
    - but tabbing or pressing enter after editing a cell keeps you in editing mode.
    I don't suppose that many people here have had experience with this, but entering Japanese (and presumably other non ascii type character sets) using MS's IME doesn't work very well with the standard JTable behaviour. If you don't double click, the entered japanese text appears in a little IME window somewhere on the screen (no neccessarily near the editing cell) and just gets lost when you press enter. You have to double click every time, and I can't see the users accepting that.
    I'll be investigating this over tme, and hopefully will be able to get it working smoothly.
    Thanks,
    Iain

  • How to set different renderers to different cells in same column of JTable?

    Hello Friends,
    I need your help again...
    Does any body knows, how to set different renderer's for different cells of same column in JTable..??
    For ex.
    Col1 Col2 Col3 Col4
    A       A       A      A
    A       A       A      B
    A       A       A      C
    A       A      A       D
    Where A B C D would be different Renderers.  I want set exactly same ,,, ie. one column with different renderer at different cell positions..
    Right now i m setting renderer using statement bellow :
    table.getColumnModel().getColumn(int).setCellRenderer(rederer_Instance);But with this, effect in the last renderer is applicable whole column....
    Can any body help me out ?????????
    please refer this thread for similar kind of discussion...
    http://forums.sun.com/thread.jspa?forumID=57&threadID=571445Thanks
    Suyog

    Please refer to the first reply of [this thread|http://forums.sun.com/thread.jspa?forumID=57&threadID=571445] for the answer. If you have a specific problem implementing it, post you code with a specific question.

  • Maybe Flex SDK bug: Setting visible of DataGrid item renderers

    Hi all, I'm still a noob at flex but this looks a bit strange to me.
    I've been trying to hide a button renderer in a DataGrid but it just wouldn't hide.  I've been setting visible inside the mxml and also in the the class that extends buttonbut it just wouldn't hide.  I then overloaded the visible property set/get and traced what was setting the property to true and found that inside DataGridBase.as the function setupColumnItemRenderer always sets visible of the renderes to true.
    DataGridBase.as
    protected function setupColumnItemRenderer(c:DataGridColumn, contentHolder:ListBaseContentHolder,
                        rowNum:int, colNum:int, data:Object, uid:String):IListItemRenderer
            var listItems:Array = contentHolder.listItems;
            var item:IListItemRenderer;
            var rowData:DataGridListData;
            item = listItems[rowNum][colNum];
            if (!item || itemToUID(item.data) != uid
                || columnMap[item.name] != c)
                item = createColumnItemRenderer(c, false, data);
                if (item == null)
                    return null;
                if (item.parent != contentHolder)
                    contentHolder.addChild(DisplayObject(item));
                // a space is used if no data so text widgets get some default size
                columnMap[item.name] = c;
                if (listItems[rowNum][colNum])
                    addToFreeItemRenderers(listItems[rowNum][colNum]);
                listItems[rowNum][colNum] = item;
            //[Matt] moved from inside the block above to outside because
            //the item definitely exists at this point, and always needs
            //its data refreshed
            rowData = DataGridListData(makeListData(data, uid, rowNum, c.colNum, c));
            rowMap[item.name] = rowData;
            if (item is IDropInListItemRenderer)
                IDropInListItemRenderer(item).listData = data ? rowData : null;
            item.data = data;
            item.visible = true;
            if (uid && colNum == 0)
                contentHolder.visibleData[uid] = item;
            return item;
    Why does it do this?  Shouldn't it respect the visible property already set for the renderer in mxml and not force it to true on init?

    Renderers use the visible property for recycling.  Invisible renderers are not supported.  The hit detection logic would find it the cell it belongs to even if it was invisible.  You can set alpha=0, but it won't stop the hit detection logic.
    Why are you trying to hide a renderer?
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • DataGrid with dynamic columns & renderers

    I'm developing using Flash Builder 4 & Flex SDK 4.1.
    I need to manage very dynamic DataGrid components and keep their definitions, which are all part of a complex item renderer of an Offers list.
    The objects structure is simplified as follows -
    Data: Model --> Offers ArrayCollection --> Offer VO --> DataGrid data ArrayCollection & DataGrid columns Array
    View: List --> Offer Item Renderer --> DataGrid
    1. Since the DataGrid's columns property accepts only an Array (not ArrayCollection), it seems like Data Binding for defining the columns is very problematic.
    I tried to bind it to the source property of an ArrayCollection that would keep my columns definitions, but it didn't really work (mainly header display bugs).
    What is the recommended way to keep the dynamic columns definition of a DataGrid?
    2. Each column can have a set of dynamic properties, so I created a "mutant" - Column VO that extends DataGridColumn and got a dynamic properties ArrayCollection on it.
    The columns got a custom header renderer that includes an icon when there are properties.
    The header renderers got 4 main states (NotSelectedWithProperties, SelectedWithProperties, NotSelectedWithoutProperties & SelectedWithoutProperties).
    However, the header renderer area seems a bit buggy when maintaning dynamic columns.
    Any thoughts on the subject?
    3. Anyway, I ended up recreating the DataGrid's columns Array very often (copying the columns definition on the offer's item renderer's dataChange event handler).
    Note that the dynamic properties can be edited when the column is selected and I copy their values from the view back to the model when entering the state NotSelectedWithProperties.
    This feels way too complicated and I really try to keep it simple, inspite of the required complexity.
    Does anyone have better ideas?
    4. In some cases the column's item renderer should also be modified into another DataGrid (grid-in-grid).
    I used the MXDataGridItemRenderer with a DataGrid and included an ArrayCollection for the "newValue" returned by the editor.
    (I use RendererIsEditor=true and on updateComplete populate that variable with the DataGrid's dataProvider contents)
    When needed, I loop though the data objects of the parent DataGrid and populate the related field with an ArrayCollection of key-value objects that are displayed on the internal DataGrid.
    After adding this feature I encounter very strange bugs -
    a. After editing the grid-in-grid values and changing the column's state (selecting & deselecting), I get the following exception:
    ArgumentError. Error #2025: The supplied DisplayObject must be a child of the caller.
    at flash.display::DisplayObjectContainer/setChildIndex()
    at mx.core::UIComponent/setChildIndex().......6993....
    All I could find about this is that it might be related to some context error or something, but I'm really stuck on this one.
    b. Sometimes another column might copy value from one row to another, running over the previous value.
    I'm not sure exactly what sequence of actions causes this behavior, but it's related to that itemRenderer for sure.
    c. Switching places with a column that uses the grid item renderer (headerShift) causes a stak overflow of StyleManager that tried to get style from the DataGridItemRenderer. This one I just found out, but couldn't reproduce a second time... strange!
    I'm pretty sure this caused another problem that I don't remember at the moment.
    The bottom line is that there got to be a better way to implement this feature within this already-complicated environment.
    Maybe I'm doing something very wrong here...
    Please advice and thanks for reading all this.

    Update on item 4a -
    This was a major issue (the main reason for opening this thread really) and I managed to resolve it!
    As part of my application, I override the default DataGrid behavior for column selection (headerRelease event).
    Instead of sorting, I change the column's header looks and define it as Selected (for showing its dynamic properties and enable its deletion).
    At first I did this by setting styles, but the look didn't refresh unless I created a new instance of the header renderer.
    Later I changed thi behavior to work with states, but I left the new header renderer instance creation commands and those lines created all the mess!
    Conclusion -
    If you define a custom header renderer for your datagrid column and then a custom item renderer, don't create a new instance of your header renderer!
    It would still be nice to get some response for the other issues I raised.
    Thanks and have a nice week.

  • What exactly are unscaledWidth and unscaledHeight in mobile item renderers?

    Hello,
    What exactly are unscaledWidth and unscaledHeight that get passed to the measure() method for a mobile item renderer?
    I am guessing renderers start at  "default" width and height (so unscaled) which get scaled based on DPI. Is that it?
    Thank you.

    measure() doesn't take any parameters so I assume you mean the layoutContents() and/or drawBackground() methods.
    If you look at the code in LabelItemRenderer (and MobileSkin) for updateDisplayList() you'll see that it just delegates the work to the drawBackground() and layoutContents() methods:
        override protected function updateDisplayList(unscaledWidth:Number,
                                                      unscaledHeight:Number):void
            // clear the graphics before calling super.updateDisplayList()
            graphics.clear();
            super.updateDisplayList(unscaledWidth, unscaledHeight);
            drawBackground(unscaledWidth, unscaledHeight);
            layoutContents(unscaledWidth, unscaledHeight);
    This was done to make it a little bit easier for people to subclass LabelItemRenderer/IconItemRenderer by breaking the positioning logic apart from drawing the background visuals.  Check out the documentation for UIComponent.updateDisplayList and look around on Google for more information on how updateDisplayList fits into the Flex component life cycle.

  • When to use Drop In Item renderer and InLine Item Renderers ??

    Hi ,
    I am getting confused in where to use Inline ItemRenderer and DropIn Item Renderer .
    What i feel is that DROP in Item Renderer are easy to use , and those can satisfy any requirements .
    What i read from tutorilas that we cant use Drop In because they say ,  The only drawback to using  drop in is that them is that you cannot configure them
    Please help me .

    Hi Kiran,
    Here is the detailed explanation you needed:
    You can also refer the link below:
    http://blog.flexdevelopers.com/2009/02/flex-basics-item-renderers.html
    Drop-In Item Renderers
    Drop-In Item Renderers are generic in nature and don't rely on specific data fields to render data. This allows them to be used with a wide range of data sets, hence, the term “drop-in”. Drop-In Item Renderers can be “dropped-in” to any list-based control regardless of the dataprovider’s data properties.
    In our previous example, the employee photo property requires use of a custom Item Renderer to render properly in the UI. In this scenario the Image component satisfies our rendering needs out of the box. Implemented as a Drop-In Item Renderer, the Image component takes any data property regardless of name and uses it as the Image component's source property value. Assuming our employee photo property contains a valid image path, the Image Drop-In Item Renderer will work perfectly and resolve the image path as an image in the UI.
    <!-- Drop-in Item Renderer: Image control -->
    <mx:DataGridColumn dataField="photo"
                       headerText="Employee Photo"
                       itemRenderer="mx.controls.Image"/>
    Drop-In Item Renderers are simple and easy to use and satisfy specific use cases nicely. However, they provide no flexibility whatsoever. If your needs are not satisfied by a Drop-In Item Renderer, you must create your own Item Renderer as an inline component or an external component.
    Inline Item Renderers
    Generally used for simple item rendering requiring minimal customization, inline Item Renderers are defined as a component nested within the MXML of your list-based control.
    It is important to note that Item Renderers nested within the itemrender property of a list-based control occupy a different scope than the list-based control. Any attempt to reference members (properties or methods) of the parent component from the nested Item Renderer component will result in a compile-time error. However, references to the members of the parent component can be achieved by utilizing the outerDocument object.
    <mx:DataGrid id="myGrid" dataProvider="{gridData}">
       <mx:columns>
          <mx:DataGridColumn headerText="Show Relevance">
             <mx:itemRenderer>
                <mx:Component>
                   <mx:Image source="{'assets/images/indicator_' + data.showRelevance + '.png'}"
                             toolTip="{(data.showRelevance == 1) ? 'On' : 'Off'}"
                             click="outerDocument.toggle()" />
                </mx:Component>
             </mx:itemRenderer>
          </mx:DataGridColumn>
       </mx:columns>
    </mx:DataGrid>
    Remember, rules of encapsulation still apply. Mark all properties or methods public if you want them accessible by your inline Item Renderer. In the previous example, the toggle() method must have a public access modifier to expose itself to the inline Item Renderer.
    public function toggle():void
    Inline Item Renderers can also be reusable by creating a named component instance outside of the list-based control. This component must have an id property and contain the rendering logic of the Item Renderer. Using data bindings, the component is assigned to the itemrenderer property of one or more data properties of a list-based control.
    <!-- Reusable inline Item Renderer -->
    <mx:Component id="ImageRenderer">
       <mx:VBox width="100%" height="140"
                horizontalAlign="center" verticalAlign="middle">
          <mx:Image source="{'assets/'+data.image}"/>
          <mx:Label text="{data.image}" />
       </mx:VBox>
    </mx:Component>
    <!-- Used within a list-based control-->
    <mx:DataGridColumn headerText="Image"
                       dataField="image" width="150"
                       itemRenderer="{ImageRenderer}"/>
    In the previous example, note that the Item Renderer component contains 2 UI controls – Image and Label. When using multiple controls within an Item Renderer, a layout container is required. In this example, a VBox was used.
    If this post answers your question or helps, please kindly mark it as such.
    Thanks,
    Bhasker Chari
    Message was edited by: BhaskerChari

  • Restrict all the text in a datagrid input without having to create custom item renderers

    Is there a way to restrict all the text in a datagrid input
    without having to create custom item renderers for each
    column?

    How are you trying to restrict it? If you're trying to
    restrict it uniformly, for example, to entirely numerical inputs,
    then the easiest way I know of to do so is with an itemEditor. You
    can just add the same itemEditor to each column that way.
    This only saves work over custom renderers if you're trying
    to restrict multiple columns in the same manner, but for numeric
    only tables, it's pretty short.
    You could probably also do it with itemEdit and
    itemEditBeginning events, but that would likely be more work then
    simply declaring a single global itemEditor and using it in all
    your columns.

  • JTables how to apply multiple cell renderers to a cell

    I have a complicated table with many different cell renderers depending on column type. (i.e check boxes, editable text fields, formatted fields, fields with icons etc..) Now I need to add the capability to color rows depending on a certain status value of a column. How can I add this capability since I already have renderers for the cells> Most examples I have seen for manipulating row colors simply extends DefaultCellRenderer for the entire table, but I already have renderers for these cells.

    Create an interface and make each renderer implement a method that colours in the background for you. Just an idea, haven't tried it myself

  • Request For Enhancement: Cell Renderers: Is the Mouse In the Cell?

    I would like to propose an enhancement to Cell Renderers: add some way for Cell Renderers to know if the mouse is currently over the cell being renderered. Currently, Cell Renderers are told only if a cell is SELECTED or has FOCUS, which are not the same thing.
    This would be of great help especially for JTable and JTableHeader, where one could provide visual feedback as the mouse moves across cells, which could be a great help for the visually impaired.

    Hi, Marsian -
    You are absolutely right about adding methods to interfaces. My mistake.
    And you are also correct that what I propose would require that cells be repainted as the mouse enters or exits that cell's bounds. If this were to prove too expensive for some applications, the JComponents that use CellRenderers could have a property to enable or disable the behavior, for example setTrackMouseMovements(boolean). But when compared to what happens when you scroll a JTable, I cannot imagine this would be anywhere nearly as expensive, and the rendering that scrolling requires--all the cells that come into view within the viewport after scrolling--seems to work just fine.
    Heck, even when you select a cell, a whole lot of cells are re-rendered. Also, when a tooltip is currently visible, if you move the mouse, the CellRenderer is consulted for each and every mouse movement, even within the same cell!!!. This seems to work fine too. Would re-rendering a cell as the mouse enters or exits its bounds by anywhere nearly as expensive?
    But you write something that still confuses me. Are you saying that you create a new Component each and every time the getXXXRendererComponent() method of your CellRenderer is called? I don't understand why one would want to do this. Can you please help me out here?
    I would think that only one instance of each Component sub-class that the CellRenderer might return would be more than good enough. And I would think that these instances would be created in the CellRenderer's constructor. Certainly, the default CellRenderer classes do not create a new Component each time a cell needs to be renderered. In fact, most of them actually extend an extension of JComponent themselves, i.e. JLabel, and return "this". No CellRenderer I have ever written has ever created a Component each time a cell is rendered. That would be very expensive.
    But still, your point about altering interfaces is well taken. Too bad.
    There must be some solution to this problem. JTable could provide the cell coordinates of the cell in which the mouse currently resides, for instance, or it could have a method that indicates if the mouse is currently over a cell with given coordinates.
    Thanks,
    ---Mark

  • Cell specific rendering with default renderers?

    I searched but I can't find the answer to my (hopefully) simply question.
    I know that I have to overwrite the getCellRenderer method in my own JTable class to specify cell specific renderers. Now my problem:
    I want to use the same renderers as the default one does like rendering a boolean value as a checkmark. How can I do this? What instance do I have to return to accomplish this?
    Thanks in advance!
    Chris M.

    How about creating your own TableCellRenderer for the column? In it you have a check, and if that check is met, return a custom component, otherwise, just return the default component by calling DefaultTableCellRenderer's version of getTableCellRendererComponent.
    public class MyTableCellRenderer extends DefaultTableCellRenderer {
        public Component getTableCellRendererComponent(JTable table,
                                                       Object value,
                                                       boolean isSelected,
                                                       boolean hasFocus,
                                                       int row,
                                                       int column) {
            if (<your condition>) {
                return <special component>;
            } else {
                return super.getTableCellRendererComponent(table, value, isSelected, hasFocus,
                    row, column);
    }Then set that renderer for your table column:
    MyTableCellRenderer myCellRenderer = new MyTableCellRenderer();
    TableColumn myColumn = myTable.getColumn("myColumnName");
    myColumn.setCellRenderer(myCellRenderer);Hope this helps!
    Barb

  • BC4J/JSP:Foreign Keys:Read Only Renderers

    I've read and implemented all of the Renderers in the Renderer how to document. I've also read 8 pages of postings to this forum regarding renderers and LOVs. And I've read reams of BC4J class documentation.
    Though the EditRenderer that does a lookup via a SQL query works well, there is no equivalent Read-only (via a SQL query) Renderer example.
    I have tried to use the examples to create a Read-only (SQL based) Renderer but I haven't had much luck.
    The closest I got to a solution was an indicator that another poster accomplishes this by modifying the generated JSP. This is clearly the wrong place to implement this functionality (doesn't allow for code re-use).
    I was also able to use the DynamicEditRenderer as a Read-Only Renderer but that would confuse my users and create bugs.
    It was my idea that you shouldn't have to define the SQL and that you could use existing BC4J classes to lookup the friendly FK value. I looked through the XML files for View Objects and View Links and saw all the information required to do this. A smart person (obviously much smarter than me), should be able to create a read-only and Edit Renderer that doesn't require a SQL property or the PK or column properties (use the UK from the db).
    Does someone have an example of a Read-Only, SQL based, Renderer? Better, has someone written a generic renderer that can track back through View Links to find the UK in the lookup table?
    This is incredibly basic functionality that I'm surprised is missing from JDeveloper.
    Please help.
    Thanks, George

    You are not going to find an 'exact' match in our existing classes. The rednering HOWTO(http://otn.oracle.com/products/jdev/howtos/jsp/renderers.html) provides enough information for implementing your readonly lookup field. If you look at the first renderer in this document, it uses a static lookup list. You can easily use a secondary view object for your lookup values. Here is the code from that document:
    package myrenderers;
    import oracle.jdeveloper.html.ReadOnlyField;
    import oracle.jbo.Row;
    import oracle.jbo.AttributeDef;
    import java.util.StringTokenizer;
    public class ListFieldRenderer extends ReadOnlyField
    public ListFieldRenderer()
    public String renderToString(Row row)
    setValueFromRow(row);
    AttributeDef aDef = getAttributeDef();
    String sAttrValue = getValue();
    String sList = (String)aDef.getProperty("DISPLAY_LIST");
    if(sAttrValue != null && sList != null)
    StringTokenizer tokens = new StringTokenizer(sList, ",", false);
    while(tokens.hasMoreTokens())
    String sEntry = tokens.nextToken();
    String sValue = sEntry.substring(sEntry.indexOf('=') + 1);
    String sKey = sEntry.substring(0, sEntry.indexOf('='));
    if(sKey.equals(sAttrValue))
    return sValue;
    return super.renderToString(row);

  • Custom Renderers in JTreeTable (or extending JTable)?

    I am wondering about what the best approach is to display a table in a Swing component. My table will by default have all rows collapsed (occupying a single line), but someone may click on a row to expand it (so it occupies multiple lines and displays more information). Nothing in the table should be editable.
    Example:
    (collapsed) 1. data     data     data
    (expanded) 2. data     data     data
    ...more data that wouldn't fit on on one line...
    ... still more data (additional data doesn't have same column format as collapsed rows)...
    (collapsed) 3. data     data     dataSo the additional data displayed when a row is expanded aren't conceptually `children' of the data in the collapsed display. I've looked at JTreeTable, but I'm not sure it's right for this purpose, and it seems complicated.
    For one thing, I need some of my columns to have custom renderers--for example, renderers that display a button with text or an image instead of just a label. However, it looks like the JTreeTable approach forces you to declare the JTree (extension) as the renderer of everything in a row, so would that prevent me from specifying custom renderers for other columns, or am I misunderstanding?
    Another feature I need is to be able to filter out entire rows from the view (so they don't show up at all). I will also want to add custom sort buttons that can apply four different sorts to each column.
    Would I be better off using a JTreeTable for this or somehow using custom renderers or otherwise extending an ordinary JTable to make the column larger and display additional information when the user clicks the expand icon?
    Also, how do I specify a different renderer for header rows than for other rows?
    Message was edited by:
    The.Joy.of.Java

    Check how editingStopped is being done. For a ComboBox there is no common operation that one can assume means that the user is done with the editing component. By default JTable leaves it active until the mouse clicks somewhere outside it, then does, essentially, fireEditingStopped() to give the cell back to the renderer. Then a second mouse click is required to start a new cell editor.
    If you're using ComboBox as a custom editor, you have to decide what event you want to be final and call fireEditingStopped() yourself. For instance, in your TableCellEditor:
        @Override
        public Component getTableCellEditorComponent(final JTable table,
                                                     final Object value,
                                                     final boolean isSelected,
                                                     final int row,
                                                     final int column) {
    ...             if( editor.supportsCustomEditor() )  {
                        JComboBox c = (JComboBox)editor.getCustomEditor();
                        c.removeActionListener( this );
                        c.addActionListener( this );
                        return c;
        @Override
        public void actionPerformed ( final ActionEvent ev ) {
            else if( "comboBoxChanged".equals( ev.getActionCommand() ) )  {
                fireEditingStopped();
        }The actionEvent is fired when just about anything happens in the ComboBox, including selection of the currently selected item. But unless you have a more specific requirement, it should be good enough.

  • DataGrid with Renderers

    Hi,
    In my project,I use the renderers handling data in the DataGrid,set variableRowHeight= "true",code:
    <mx:DataGrid id="archiveAchiveList"
    width="200"
    height="102" width="200"
    variableRowHeight="true"
    scroll="archiveAchiveList.invalidateList();archiveAchiveList.setFocus()"
    verticalScrollPolicy="on"
    dataProvider="{Model.InfoList}">
    <mx:columns>
    <mx:DataGridColumn headerText="Structure Name"
    dataField="structName"
    width="200"
    wordWrap="true"
    color="black"
    itemRenderer="components.renderers.ClickHtmlTextListItemRenderers"/>
    ClickHtmlTextListItemRenderers,code:
    <?xml version="1.0" encoding="utf-8"?>
    <s:MXDataGridItemRenderer
    xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/mx"
    focusEnabled="true"
    initialize="init()">
    <mx:Text id="txt" width="100%" top="0" left="0" right="0" bottom="0" text="{dataGridListData.label}" click="itemClickHandler(event)"/>
    </s:MXDataGridItemRenderer>
    Now the problems is, the data in the DataGrid displays the exception.
    Like the picture below:
    Please suggest.
    Thansk and regards,
    Shotterrss

    i am so sorry that i posted the wrong code yesterday,
    the problem code should be:
    ClickHtmlTextListItemRenderers,code:
    <?xml version="1.0" encoding="utf-8"?>
    <s:MXDataGridItemRenderer
    xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/mx"
    focusEnabled="true"
    initialize="init()">
    <mx:Text  id="txt" width="100%"   text="{dataGridListData.label}" click="itemClickHandler(event)"/>
    </s:MXDataGridItemRenderer>
    Now the problems is, the data in the DataGrid displays the exception.
    Please suggest.
    Thanks and regards,
    Shotterrss

  • Updating the dataprovider of a datagrid with itemrenderers throws renderers

    Hello all,
    I've run into a problem that I can't seem to figure out.  I have a datagrid that is bound to an arraycollection as the data provider.  A few of my DataGridColumns have itemrenderers.  The renderers work great on the first run, but once the dataprovider is updated, my datagrid renderers fall apart.
    My renderers basically highlight cell items that fall into a particular range. Interestingly, if I have an itemrenderer attached on any dataGridColumn, I get a few repeating/identical rows and itemrenderes that are active in places that they shouldn't be once the dataprovider is updated. Has anyone run into this? How did you solve this? Thanks in advance!!
    Mike

    Another way to create itemRenderer for datagrid is to have a custom components that implements these objects
    mx.controls.listClasses.IDropInListItemRenderer,mx.controls.listClasses.IListItemRenderer, mx.core.IFactory
    For example
    <s:SkinnableContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/mx"
    implements="mx.controls.listClasses.IDropInListItemRenderer,mx.controls.listClasses.IListItemRenderer, mx.core.IFactory">
    private var _data:Object;
    private var _listData:BaseListData;
    public function newInstance():*
         return new myItemRenderer; // name of your renderer
    public function set data(value:Object):void
         dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
    [Bindable("dataChange")]
    public function get data():Object
    public function set listData(value:BaseListData):void
    public function get listData():BaseListData
    </s:SkinnableContainer>

  • [svn:fx-trunk] 11933: Addressing an edge case for TileList where at times the listItems array doesn 't accurately reflect a fully realized set of item renderers.

    Revision: 11933
    Revision: 11933
    Author:   [email protected]
    Date:     2009-11-18 06:55:18 -0800 (Wed, 18 Nov 2009)
    Log Message:
    Addressing an edge case for TileList where at times the listItems array doesn't accurately reflect a fully realized set of item renderers.  This can occur when the TileList row/col creation routine bails out early when it believes it has no further need to create renderers due to current height of the list itself.
    QE notes:  None
    Doc notes: None
    Bugs: SDK-24169
    Reviewer: Alex
    Tests run: List, TileList, HorizontalList, DataGrid
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-24169
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/listClasses/ListBase.as

    Due to a copy/paste glitch, some necessary spaces have inadvertently been removed.  If I could fix this, I would.

Maybe you are looking for