CellRenderer API samples – Datagrid -
by Carlos Pinho, January 31st, 2007
  • Share
  • Share

Hi, another post today.

This time i will speak about datagrid component. How many of us, didn’t want to customize our datagrid or our list component aon a Flash movie? Is it difficult?

For those who think yes, pls check following links and source files.

Hope now people can improve their skills using these technique’s.

Example 1

Example 1

Download Source files example 1

Example 2

Example 2

Code of this example

var gc2 = new DataGridColumn("country");
gc2.width = 100;
gc2.headerText = "Country:";
gc2.cellRenderer = "IconCellRenderer";
gc2.iconFunction = contactIconFunction;

Declare contactIconFunction as follows:

contactIconFunction = function (itemObj:Object, columnName:String) {
if (itemObj == undefined || columnName == undefined) {
return;
}
switch (columnName) {
case "country":
var country = itemObj.country;
return (country == undefined ? undefined : "flag_"+country);
break;
}
}

Download source file example 2

Example 3

Example 3

Download source file example 3

Hope you enjoy.

Tags: , , , , , , ,

Copy and Paste the code below
Email and IM
Websites
Forums
Get This

No Responses to “CellRenderer API samples – Datagrid -”

  1. daniel Says:

    hi!!

    i have some doubts..

    i can make a link for each data in a datagrid?

  2. cpinho Says:

    Hello Daniel,

    Didn’t understand what do you mean with link for each datagrid.

    Is it to use links inside datagrid as data? if so check this post http://flashenabled.wordpress.com/2007/02/02/datagrid-cellrenderer-more-examples/

    If you have any other question, leave your post here.

    Brgds,
    CP

  3. Munira Says:

    hello…
    will u plz help me…
    i want to make a link of each data in a datagrid column
    means text which is display in a datagrid column..

  4. cpinho Says:

    i will try. on the text you must use html. Check the html cell renderer at http://flashenabled.wordpress.com/2007/02/05/datagrid-htmlcellrenderer/

    hope it can help. let me know.

    brgds,
    cp

  5. Aaron Says:

    Thanks for the examples.

    Is it possible to show a small video window in a datagrid?

  6. cpinho Says:

    Dear Aaron,

    Hi. Never tried but i think so. I beleive you must import FLV component inside the datagrid in order you can use it like on the example 3.

    Brgds,
    CP

  7. theN Says:

    Can I have a example in CS3, and how can I have a dragable row from DataGrid.

  8. Carlos Pinho Says:

    I think you might want to try the flex or air. Because it was the only program i know it is possible to do it. On Flash never tried.

  9. Colin Says:

    Hi,

    Ive been looking for something to explain how to use cellrenderer, mainly so that I can simply have text wrap around in the cells.

    The only examples Ive found so far have allowed the text to display outside the boundaries of its cell, although it certainly wraps OK. I dont claim to understand why.

    I ran up this example to see if it dies what I need, so that I could then try and understand how it works.

    But Im using Actionscript 3. It complains that the definition of baseclass UIComponent was not found on line 11 of MultilineCell.as.

    Is there a simple fix ?

    You probably guessed, Im new to Flash and AS3, but Im learning quickly . . .

Let leave a Comments for this post.