Welcome, Guest. Please login or register.
Did you miss your activation email?
05/22/12, 06:39
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  General
| |-+  Flash and AS 3 (Moderators: papachan, kofi addaquay)
| | |-+  CellRenderer For only one Cell in Datagrid- HOW?
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: CellRenderer For only one Cell in Datagrid- HOW?  (Read 2231 times)
gattaka
Server what's that
*
Posts: 2


View Profile
« on: 03/07/09, 13:17 »

Hi:

May be it sounds funny, but I use dataGrdi for Input Form. That's a good chance to training except all with CellRenderer.
There are no good full tutorials on extending data grid!
So how to put combobox or other UIComponnet only in ONE cell of dataGrid? Whats the method to use? And of what componnent-data grid? list? Column?
If I use something like:

myDataGrid.getColumnAt(1).cellRenderer=myComboBoxRenderer;

where  myComboBoxRenderer  in separate class, extends Combobox and implements ICellRenderer. In  ALL cells of column_1  combobox is drawn!
But I need combobox only in one cell of column_1 and correct data in others.
The sample of form:

column_0|  column_1
-------------------------------
name:     | input textfield
email   :   | input textfield
country:   | COMBOBOX //user can choose his country. Later I want to add auto definition of country by using separate services. If users couuntry is wrong he choose right.

Some code:
......................



private function createDataGrid(w : uint,h : uint) : void {
       
var dp: DataProvider = new DataProvider();      
dp.addItem( { c1: "Name",c2:"your name, please" } );
dp.addItem( { c1: "Email",c2:"your mail please"});
dp.addItem( { c1: "Country",data:[{label:"Country",data:null},{label:"Usa",data:null},{label:"Italy",data:null},{label:"Germany",data:null}]});
                  
         var c1 : DataGridColumn = new DataGridColumn("c1");//labels
         var c2 : DataGridColumn = new DataGridColumn("c2");//imput text fields
   
         dg = new DataGrid();
         dg.addColumn(c1);
         dg.addColumn(c2);
         dg.dataProvider = dp;
              dg.getColumnAt(1).cellRenderer =CmboxRenderer;
   
}

Where I have to check format of data for cells in column_1 - in CmboxRenderer? If so how can I denied drawing of  a combobox  and leave just input text field?
I tried to use invalidate method in CmboxRenderer, but anyway all cells draw combobox. One of them working of course,but the other two not-there are no data for them.
 All ideas much uppreciated. May be somebody knows good tutorials. CS4. Adobe is very nice -only show how to add button in all cells of column. ANd nothing more.
Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6175


View Profile WWW Email
« Reply #1 on: 03/07/09, 14:19 »

Datagrid is a grid of rows - all rows are the same.

It is meant to be used to access database records, or alike.

It is not meant to be used for graphical positioning.

Therefor you should use forms.

You can create a form from code, by loading the component, and positioning.
Logged

happy flashing
Cool
Ronald
gattaka
Server what's that
*
Posts: 2


View Profile
« Reply #2 on: 03/08/09, 08:36 »

Thnx, but I let me be disagreed Smiley.
For example as an admin you have to edit column_country in datagrid with all your registered visitors and only wrong countries should be edited by combobox. The column_country_cell should be edited if there is a combobox. If no combobox -all is correct. May this is not very usefull sample -but this datagrid. No form.
I will build form in 5 minutes Smiley. But this question as like a puzzle. 
My first posts (other login) here were about 5 years ago or vise versa -about AMFPHP. You see I use all this and like your site!
Thank you!
But question is open and I am finding tutorials or solutions. It is generall question -
If (true){draw component in cell of datagrid}else{not}// I understand that dataGrid consists of coulumns, and question is in list of column.

The solution is IMHO in CmboxRenderer class;
It us used in Class that buil dataGrid:
dg.getColumnAt(1).cellRenderer =CmboxRenderer;

Where inside component class ( CmboxRenderer in my situation)  stop draw component before check type of data for it. Or other words
- how inside cellRenderer delete itself and leave parent cell's  data and format by default?

Logged
namrata2811
Server what's that
*
Posts: 1


View Profile Email
« Reply #3 on: 02/02/10, 01:03 »

Can you post the code for your ComboBox Custom Class?
Logged
Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!