Welcome, Guest. Please login or register.
Did you miss your activation email?
05/22/12, 17:53
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 8 (Moderators: Jorge Solis, ..:: Mazhar Hasan ::.., Andresss)
| | |-+  Combobox Cellrenderer problem
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: 1 [2] Print
Author Topic: Combobox Cellrenderer problem  (Read 2437 times)
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #15 on: 12/12/10, 21:14 »

Is the combobox behind a mask? Did you embed fonts if that's true?
Also try adding a combobox component in the library of root movie

Jorge
Logged

neatgadgets
Server what's that
*
Posts: 17


View Profile Email
« Reply #16 on: 12/12/10, 21:19 »

Not sure if this helps, but I have just setup a second datagrid, this time using only this code and a new datagrid instance dragged from the library.

data_array = new Array();
data_array.push({Model:[{label:"Ford", data:"1000"}, {label:"Chevrolet", data:"800"}, {label:"Renault", data:"1600"}], Year:"Ten"});
data_array.push({Model:[{label:"Ford", data:"1500"}, {label:"Fiat", data:"1000"}, {label:"Mercedes", data:"2500"}], Year:"Five"});
data_array.push({Model:[{label:"Mitsubishi", data:"1200"}, {label:"Mazda", data:"1800"}, {label:"Renault", data:"2000"}], Year:"Two"});
myDataGrid_dg.dataProvider = data_array;

Only difference really is that the code that populates the datagrid I want populated is fired when an item from yet another datagrid is selected. So to make that clear, you select a row from the selection datagrid, and it populates several fields as well as this datagrid. The data is populated fine apart from the comboboxes.

I'll try the your suggestions above.
Logged
neatgadgets
Server what's that
*
Posts: 17


View Profile Email
« Reply #17 on: 12/13/10, 00:03 »

I have narrowed it down further:

This works
Code:

var column = new DataGridColumn("Selected");
column.headerText = "Selected";
column.width = 40;
column.cellRenderer = "CheckCellRenderer";
myDataGrid_dg.addColumn(column);

var column = new DataGridColumn("Model");
column.headerText = "Model";
column.width = 150;
column.cellRenderer = "ComboBoxCellRenderer";
myDataGrid_dg.addColumn(column);

var column = new DataGridColumn("Year");
column.headerText = "Year";
column.width = 100;
column.cellRenderer = "IconCellRenderer";
myDataGrid_dg.addColumn(column);

//Create a dataProvider to add some data to the Datagrid
data_array = new Array();
data_array.push({Model:[{label:"Ford", data:"1000"}, {label:"Chevrolet", data:"800"}, {label:"Renault", data:"1600"}], Year:"Ten"});
data_array.push({Model:[{label:"Ford", data:"1500"}, {label:"Fiat", data:"1000"}, {label:"Mercedes", data:"2500"}], Year:"Five"});
data_array.push({Model:[{label:"Mitsubishi", data:"1200"}, {label:"Mazda", data:"1800"}, {label:"Renault", data:"2000"}], Year:"Two"});
myDataGrid_dg.dataProvider = data_array;


But this does not work:

Code:
var column = new DataGridColumn("sample_id");
column.headerText = "sample_id";
column.width = 70;
myDataGrid_dg.addColumn(column);

var column = new DataGridColumn("std_source_id");
column.headerText = "std_source_id";
column.width = 70;
myDataGrid_dg.addColumn(column);

var column = new DataGridColumn("species_id");
column.headerText = "species_id";
column.width = 150;
column.cellRenderer = "ComboBoxCellRenderer";
myDataGrid_dg.addColumn(column);


var column = new DataGridColumn("timeseg");
column.headerText = "timeseg";
column.width = 70;
myDataGrid_dg.addColumn(column);

var column = new DataGridColumn("reliability_index");
column.headerText = "reliability_index";
column.width = 70;
myDataGrid_dg.addColumn(column);

var column = new DataGridColumn("notes");
column.headerText = "notes";
column.width = 70;
myDataGrid_dg.addColumn(column);


data_array = new Array();
data_array.push({sample_id:"sample_id 1",std_source_id:"std_source_id 1",species_id:[{label:"Species 1", data:"1"}, {label:"Species 2", data:"2"}, {label:"Species 3", data:"3"}], timeseg:"timeseg", reliability_index:"reliability_index", notes:"notes"});
data_array.push({sample_id:"sample_id 1",std_source_id:"std_source_id 2",species_id:[{label:"Species 1", data:"1"}, {label:"Species 2", data:"2"}, {label:"Species 3", data:"3"}], timeseg:"timeseg", reliability_index:"reliability_index", notes:"notes"});
data_array.push({sample_id:"sample_id 1",std_source_id:"std_source_id 3",species_id:[{label:"Species 1", data:"1"}, {label:"Species 2", data:"2"}, {label:"Species 3", data:"3"}], timeseg:"timeseg", reliability_index:"reliability_index", notes:"notes"});
myDataGrid_dg.dataProvider = data_array;
Logged
neatgadgets
Server what's that
*
Posts: 17


View Profile Email
« Reply #18 on: 12/13/10, 00:26 »

Ok not quite solved, but if I changed the word "Model" in each instance in the code that works to "model", then the code stops working. However just capitolising the non working code does not help. Very odd!!!!
« Last Edit: 12/13/10, 00:45 by neatgadgets » Logged
neatgadgets
Server what's that
*
Posts: 17


View Profile Email
« Reply #19 on: 12/13/10, 01:01 »

Ok, found the issue:

Code:
function setValue(str:String, item:Object, sel:Boolean) : Void
{ //Get values from the dataProvider
//item.Model is an array of labels/data pairs
combo._visible = (item!=undefined);
combo.dataProvider = item.Model;
}
   

item.Model is the issue.

 I thought this was a dynamic .as script but it is not. Is there some way to make this dynamic?
Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #20 on: 12/13/10, 06:33 »

Instead of Model you're using species_id

Jorge
Logged

neatgadgets
Server what's that
*
Posts: 17


View Profile Email
« Reply #21 on: 12/13/10, 17:19 »

Yep I found that now. But is there anyway to remove the hardcoded "item.Model" and make it dynamic? ie pass the column name to the script?

Also wondering how to change the dropdownWidth

I tried

      combo.dropdownWidth = 200;

in the createChildren function but this did nothing.

And one other thing is that if the datagrid is editable, and you tab through, it erases the entire drop down. Not sure why this is the case or how to fix it.
« Last Edit: 12/13/10, 22:05 by neatgadgets » Logged
chenchen21621
Server what's that
*
Posts: 2


View Profile Email
« Reply #22 on: 12/22/10, 20:54 »

I've finally got back to working with this and have managed to get everything going apart from one small but important part. The labels are not showing in any of the drop down boxes.
I have traced the data and all is correct.
I have setup the cellrenderer MovieClip in the Library, and there is an instance of the CheckBox in the Library.

I did note that the icon next to the instance of the ComboBox in the library was different so I copied the ComboBox fom the cars_flash-db.fla to my fla file. This made no difference.
The other difference is that I have the CellRenderer as file in the root with the fla, but I have relfected this difference in the properties.
« Last Edit: 12/23/10, 03:23 by Ronald Wernecke » Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6175


View Profile WWW Email
« Reply #23 on: 12/23/10, 03:25 »

Which Flashversion are you using?
How you load the data?
Could you give a life link, to have a look?
Logged

happy flashing
Cool
Ronald
Pages: 1 [2] 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!
anything