No DataGrid component?

I believe JavaFX seriously needs a DataGrid component to render tabular data as a GRID, where data can be paged, sorted, filtered like other data grid solutions (Adobe Flex, jQGrid, DataTables etc).
This is one of the basic controls, any serious application would definitely need. TableView is the only closest thing I found, but that doesn't fit the bill at all.
The DataFx project looks promising, but is very primitive.
I hope Oracle will come up with a pretty GRID control soon, to beat the competition. We were planning to go with JavaFX and the only thing that is stopping us is the lack of a GRID component, we have to look for other web-based alternatives now.

I think there's more to the TableView API than you're seeing, as it's supported by the JavaFX Properties and Collections APIs. The columns are exposed as a mutable, observable List, as is the data. So the columns are dynamic and can be readily changed as necessary, the table will update automatically.
I used you example as a way to test this out; I've made no effort whatsoever to make this look good, the css is relatively straightforward. Also, I have no knowledge whatsoever of your business domain, so this will likely look somewhat naive. I think the code structure might be helpful though. There are some things I wish were a bit different but I'll come to that after the code.
I'm going to assume you have some kind of data model and some way of knowing when the data's changed. I've mocked this up with a DataModel class with listener notification, but there are other ways this could happen (could be an EJB, for example). I've made this completely agnostic with respect to JavaFX.
DataModel.java (a mockup of something I assume you already have existing):
import java.util.ArrayList;
import java.util.List;
public class DataModel {
     private double minDeviation ;
     private double maxDeviation ;
     private int numDeviationCategories ;
     private int numRows ;
     private List<DataListener> listeners ;
     public DataModel(double minDeviation, double maxDeviation,
               int numDeviationCategories, int numRows) {
          this.minDeviation = minDeviation;
          this.maxDeviation = maxDeviation;
          this.numDeviationCategories = numDeviationCategories;
          this.numRows = numRows;
          this.listeners = new ArrayList<DataListener>();
     public String getValue(int row, double deviation) {
          int category = (int) ((numDeviationCategories - 1)*(deviation - minDeviation) / (maxDeviation - minDeviation)) ;
          return String.format("f(%d, %d)", category+1, row+1);
     public double getMinDeviation() {
          return minDeviation;
     public void setMinDeviation(double minDeviation) {
          if (minDeviation != this.minDeviation) {
               this.minDeviation = minDeviation;
               fireDeviationRangeChanged();
     public double getMaxDeviation() {
          return maxDeviation;
     public void setMaxDeviation(double maxDeviation) {
          if (maxDeviation != this.maxDeviation) {
               this.maxDeviation = maxDeviation;
               fireDeviationRangeChanged();
     public int getNumDeviationCategories() {
          return numDeviationCategories;
     public void setNumDeviationCategories(int numDeviationCategories) {
          if (numDeviationCategories != this.numDeviationCategories) {
               this.numDeviationCategories = numDeviationCategories;
               fireNumDeviationCategoriesChanged();
     public int getNumRows() {
          return numRows;
     public void setNumRows(int numRows) {
          if (this.numRows != numRows) {
               this.numRows = numRows;
               fireNumRowsChanged();
     public void addDataListener(DataListener l) {
          listeners.add(l);
     public void removeDataListener(DataListener l) {
          listeners.remove(l);
     private void fireDeviationRangeChanged() {
          DataEvent event = new DataEvent(this);
          for (DataListener l : listeners) {
               l.deviationRangeChanged(event);
     private void fireNumDeviationCategoriesChanged() {
          DataEvent event = new DataEvent(this);
          for (DataListener l : listeners) {
               l.numDeviationCategoriesChanged(event);
     private void fireNumRowsChanged() {
          DataEvent event = new DataEvent(this);
          for (DataListener l : listeners) {
               l.numRowsChanged(event);
}And there are two almost trivial supporting classes to support the listener notification:
public interface DataListener {
     public void deviationRangeChanged(DataEvent event);
     public void numDeviationCategoriesChanged(DataEvent event);
     public void numRowsChanged(DataEvent event);
public class DataEvent {
     private final DataModel source ;
     public DataEvent(DataModel source) {
          this.source = source;
     public DataModel getSource() {
          return source;
}The TableView exposes ObservableLists for the columns and the data. We need to update those lists when the data or column structure changes. So we need an adapter to sit in front of our generic DataModel and manipulate those lists when the data changes. This class will take a reference to a DataModel in addition to references to the column list and data list; it will listen for notifications from the DataModel and update the lists as necessary. (I'm implementing each row in the table simply as a List<String>, and we retrieve each element from the row using a custom CellValueFactory.)
TableDataModel.java:
public class TableDataModel {
     private DataModel model ;
     private final ObservableList<TableColumn<List<String>, ?>> columns ;
     private final ObservableList<List<String>> items ;
     public TableDataModel(DataModel model, ObservableList<TableColumn<List<String>, ?>> columns, ObservableList<List<String>> items) {
          this.model = model ;
          this.columns = columns;
          this.items = items ;
          buildColumns();
          buildItems();
          model.addDataListener(new ModelListener());
     private void buildColumns() {
          int numCols = model.getNumDeviationCategories();
          List<TableColumn<List<String>, String>> colList = new ArrayList<TableColumn<List<String>, String>>();
          double minDeviation = model.getMinDeviation() ;
          double maxDeviation = model.getMaxDeviation() ;
          double colDeviationIncrement = (maxDeviation - minDeviation) / (numCols-1) ;
          Format percentFormat = DecimalFormat.getPercentInstance();
          for (int col=0; col<numCols; col++) {
               String colTitle = percentFormat.format(minDeviation + col*colDeviationIncrement);
               TableColumn<List<String>, String> column = new TableColumn<List<String>, String>(colTitle);
               final int colIndex = col ;
               column.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<List<String>,String>,ObservableValue<String>>() {
                    @Override
                    public ObservableValue<String> call(
                              CellDataFeatures<List<String>, String> cellDataFeatures) {
                         List<String> data = cellDataFeatures.getValue();
                         return new SimpleStringProperty(data.get(colIndex));
               colList.add(column);
          columns.clear();
          columns.addAll(colList);
     private void buildItems() {
          List<List<String>> itemList = new ArrayList<List<String>>();
          int numCols = model.getNumDeviationCategories() ;
          for (int row = 0; row<model.getNumRows(); row++) {
               List<String> data = new ArrayList<String>();
               double minDeviation = model.getMinDeviation() ;
               double colDeviationIncrement = (model.getMaxDeviation() - minDeviation) / (numCols-1) ;
               for (int col = 0 ; col < numCols; col++) {
                    double deviation = minDeviation + col * colDeviationIncrement ;
                    data.add(model.getValue(row, deviation));
               itemList.add(data);
          items.clear();
          items.addAll(itemList);
     private class ModelListener implements DataListener {
          @Override
          public void deviationRangeChanged(DataEvent event) {
               double minDeviation = model.getMinDeviation();
               double maxDeviation = model.getMaxDeviation();
               int numCols = model.getNumDeviationCategories();
               double colDeviationIncrement = (maxDeviation - minDeviation) / (numCols-1);
               Format percentFormat = DecimalFormat.getPercentInstance();
               for (int col=0; col<numCols; col++) {
                    String colTitle = percentFormat.format(minDeviation + col*colDeviationIncrement);
                    columns.get(col).setText(colTitle);
          @Override
          public void numDeviationCategoriesChanged(DataEvent event) {
               buildItems();
               buildColumns();
          @Override
          public void numRowsChanged(DataEvent event) {
               buildItems();
}To test this out, I have a simple UI for changing the range of "deviations" displayed, the number of columns, and the number of rows. The controller for the UI simply instantiates a DataModel and passes calls to it when the user changes these values. In real life, of course, the changes to the data model could come from anywhere - likely from polling a server or server push. The UI also contains the TableView, retrieves the columns and items from it, and passes those, along with the data model to a TableDataModel which ties it all together. This isn't really part of the infrastructure, but for completeness here's the controller:
Controller.java
public class Controller {
     @FXML private TableView<List<String>> tableView ;
     @FXML private TextField minDevTF ;
     @FXML private TextField maxDevTF ;
     @FXML private TextField numColsTF ;
     @FXML private TextField numRowsTF ;
     @FXML private Button minDevIncButton ;
     @FXML private Button minDevDecButton ;
     @FXML private Button maxDevIncButton ;
     @FXML private Button maxDevDecButton ;
     @FXML private Button numColsIncButton ;
     @FXML private Button numColsDecButton ;
     @FXML private Button numRowsIncButton ;
     @FXML private Button numRowsDecButton ;
     private DataModel model ;
     public void initialize() {
          model = new DataModel(0.8, 1.2, 5, 6);
          final TableDataModel tableModel = new TableDataModel(model, tableView.getColumns(), tableView.getItems());
          model.addDataListener(new DataListener() {
               @Override
               public void deviationRangeChanged(DataEvent event) {
                    if (model.getMaxDeviation() - model.getMinDeviation() <= 0.01) {
                         minDevIncButton.setDisable(true);
                         maxDevDecButton.setDisable(true);
                    } else {
                         minDevIncButton.setDisable(false);
                         maxDevDecButton.setDisable(false);
                    Format percentFormat = DecimalFormat.getPercentInstance();
                    minDevTF.setText(percentFormat.format(model.getMinDeviation()));
                    maxDevTF.setText(percentFormat.format(model.getMaxDeviation()));
               @Override
               public void numDeviationCategoriesChanged(DataEvent event) {
                    numColsDecButton.setDisable(model.getNumDeviationCategories() <= 2);
                    numColsTF.setText(Integer.toString(model.getNumDeviationCategories()));
               @Override
               public void numRowsChanged(DataEvent event) {
                    numRowsDecButton.setDisable(model.getNumRows() <= 2);
                    numRowsTF.setText(Integer.toString(model.getNumRows()));
          Format percentFormat = DecimalFormat.getPercentInstance();
          minDevTF.setText(percentFormat.format(model.getMinDeviation()));
          maxDevTF.setText(percentFormat.format(model.getMaxDeviation()));
          numColsTF.setText(Integer.toString(model.getNumDeviationCategories()));
          numRowsTF.setText(Integer.toString(model.getNumRows()));
     public void decrementMinDeviation() {
          model.setMinDeviation(model.getMinDeviation() - 0.01);
     public void incrementMinDeviation() {
          model.setMinDeviation(model.getMinDeviation() + 0.01);
     public void decrementMaxDeviation() {
          model.setMaxDeviation(model.getMaxDeviation() - 0.01);
     public void incrementMaxDeviation() {
          model.setMaxDeviation(model.getMaxDeviation() + 0.01);
     public void decrementNumColumns() {
          model.setNumDeviationCategories(model.getNumDeviationCategories() - 1);
     public void incrementNumColumns() {
          model.setNumDeviationCategories(model.getNumDeviationCategories() + 1);
     public void decrementNumRows() {
          model.setNumRows(model.getNumRows() - 1);
     public void incrementNumRows() {
          model.setNumRows(model.getNumRows() + 1);
}Here's the FXML for the UI:
root.fxml:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.layout.FlowPane?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.shape.Path?>
<?import javafx.scene.shape.MoveTo?>
<?import javafx.scene.shape.LineTo?>
<?import javafx.scene.shape.ClosePath?>
<?import javafx.scene.paint.Color?>
<?import javafx.scene.control.ProgressIndicator?>
<BorderPane xmlns:fx="http://javafx.com/fxml"
     fx:controller="edu.marshall.denvir.tests.gridlike.Controller">
     <top>
          <FlowPane>
               <HBox>
                    <Label text="Min Deviation:"/>
                    <TextField fx:id="minDevTF" editable="false" />
                    <VBox>
                         <Button fx:id="minDevIncButton" prefWidth="20" prefHeight="10" minWidth="20" minHeight="10" onAction="#incrementMinDeviation">
                              <graphic>
                              <Path fill="BLACK">
                                   <elements>
                                        <MoveTo x="0" y="4"/>
                                        <LineTo x="2" y="0"/>
                                        <LineTo x="4" y="4"/>
                                        <ClosePath/>
                                   </elements>
                              </Path>
                              </graphic>                              
                         </Button>
                         <Button fx:id="minDevDecButton" prefWidth="20" prefHeight="10" minWidth="20" minHeight="10" onAction="#decrementMinDeviation">
                              <graphic>
                              <Path fill="BLACK">
                                   <elements>
                                        <MoveTo x="0" y="4"/>
                                        <LineTo x="2" y="0"/>
                                        <LineTo x="4" y="4"/>
                                        <ClosePath/>
                                   </elements>
                              </Path>
                              </graphic>                              
                         </Button>
                    </VBox>
               </HBox>
               <HBox>
                    <Label text="Max Deviation:" />
                    <TextField fx:id="maxDevTF" editable="false" />
                    <VBox>
                         <Button fx:id="maxDevIncButton" prefWidth="20" prefHeight="10" minWidth="20" minHeight="10"  onAction="#incrementMaxDeviation" styleClass="increment-button">
                              <graphic>
                              <Path fill="BLACK">
                                   <elements>
                                        <MoveTo x="0" y="4"/>
                                        <LineTo x="2" y="0"/>
                                        <LineTo x="4" y="4"/>
                                        <ClosePath/>
                                   </elements>
                              </Path>
                              </graphic>
                         </Button>
                         <Button fx:id="maxDevDecButton" prefWidth="20" prefHeight="10" minWidth="20" minHeight="10"  onAction="#decrementMaxDeviation">
                              <graphic>
                              <Path fill="BLACK">
                                   <elements>
                                        <MoveTo x="0" y="4"/>
                                        <LineTo x="2" y="0"/>
                                        <LineTo x="4" y="4"/>
                                        <ClosePath/>
                                   </elements>
                              </Path>
                              </graphic>
                         </Button>
                    </VBox>
               </HBox>
               <HBox>
                    <Label text="Number of columns:" />
                    <TextField fx:id="numColsTF" editable="false" />
                    <VBox>
                         <Button fx:id="numColsIncButton" prefWidth="20" prefHeight="10" minWidth="20" minHeight="10" onAction="#incrementNumColumns">
                              <graphic>
                              <Path fill="BLACK">
                                   <elements>
                                        <MoveTo x="0" y="4"/>
                                        <LineTo x="2" y="0"/>
                                        <LineTo x="4" y="4"/>
                                        <ClosePath/>
                                   </elements>
                              </Path>
                              </graphic>
                         </Button>
                         <Button fx:id="numColsDecButton" prefWidth="20" prefHeight="10" minWidth="20" minHeight="10" onAction="#decrementNumColumns">
                              <graphic>
                              <Path fill="BLACK">
                                   <elements>
                                        <MoveTo x="0" y="4"/>
                                        <LineTo x="2" y="0"/>
                                        <LineTo x="4" y="4"/>
                                        <ClosePath/>
                                   </elements>
                              </Path>
                              </graphic>
                         </Button>
                    </VBox>
               </HBox>
               <HBox>
                    <Label text="Number of Rows:" />
                    <TextField fx:id="numRowsTF" editable="false" />
                    <VBox>
                         <Button fx:id="numRowsIncButton" prefWidth="20" prefHeight="10" minWidth="20" minHeight="10"  onAction="#incrementNumRows">
                              <graphic>
                              <Path fill="BLACK">
                                   <elements>
                                        <MoveTo x="0" y="4"/>
                                        <LineTo x="2" y="0"/>
                                        <LineTo x="4" y="4"/>
                                        <ClosePath/>
                                   </elements>
                              </Path>
                              </graphic>
                         </Button>
                         <Button fx:id="numRowsDecButton" prefWidth="20" prefHeight="10" minWidth="20" minHeight="10" onAction="#decrementNumRows">
                              <graphic>
                              <Path fill="BLACK">
                                   <elements>
                                        <MoveTo x="0" y="4"/>
                                        <LineTo x="2" y="0"/>
                                        <LineTo x="4" y="4"/>
                                        <ClosePath/>
                                   </elements>
                              </Path>
                              </graphic>
                         </Button>
                    </VBox>
               </HBox>
          </FlowPane>
     </top>
     <center>
               <TableView fx:id="tableView"/>
     </center>
</BorderPane>and finally the test driver:
Gridlike.java:
public class Gridlike extends Application {
     @Override
     public void start(Stage primaryStage) throws Exception {
          Parent root = FXMLLoader.load(getClass().getResource("root.fxml"));
          Scene scene = new Scene(root, 600, 400);
          primaryStage.setScene(scene);
          primaryStage.sizeToScene();
          primaryStage.show();
     public static void main(String[] args) {
          launch(args);
}So that seems to me not to be too bad. Obviously in the real world there's likely to be way more functionality in the data model and table data model implementations, but the structure is pretty clean and it should integrate pretty nicely with existing structures without much effort.
One thing I don't like is having to pass the ObservableLists to the TableDataModel. I'd prefer the TableDataModel simply to instantiate it's own lists and expose them, the way it is seems like too much strong couple from the model to the view. The problem is that the TableView only exposes ObservableLists. If it exposed ListPropertys, then those properties could just be bound to arbitrary list properties (or observable lists) exposed by a TableDataModel, which I think would be a bit cleaner.
In terms of having APIs for binding directly from TableViews to JDBC code, or similar, I think that would be nice but is probably a bit unrealistic at this stage. What happened in the web app world was that this kind of functionality was implemented by third party frameworks, and only after the use cases had really settled down did Sun/Oracle provide standard implementations (JPA and JSF, depending on what you're looking for). I don't think we'll have to wait as long as we waited for those, but I'd guess it will be a while.
The row headers, however, would be pretty nice, and it seems those could be fairly easily added to the TableView API. It shouldn't be too hard to create a column for them and style it so it looks different, but it would mess with the cleanliness of the data model.
Just my $0.02 worth...

Similar Messages

  • Flash 2.0 Datagrid component bug ?

    Recently I found a bug in Datagrid component. The swf file
    which contain datagrid act differely in IE 6, and IE 7.
    This is what I've done:
    1) Compile swf, export it together with html file.
    2) Run the html file
    3)Press on one of the cell,drag it and then release it
    outside of the browser/flash canvas.
    4)Move the mouse pointer back to flash canvas
    5)The grid will scroll automatically( move the move up and
    down to test)
    6)After a few times mouse pointer movement, suddenly IE
    crash, CPU usage 100%
    I have tested the swf file on firefox 2.007 and stand alone
    flash player, however, none of the flash player have this bug.
    Therefore I suspect that the ActiveX flash plugin for IE cause this
    bug.
    This is the source code, which I use to create the datagrid
    for testing.
    ps: open one fla file, drag datagrid component from component
    panel to the stage or it will not run.
    import mx.controls.DataGrid;
    var header = "Stock Code/\nName,Type,Status,Order
    Date\nTime,Duration,OrderQty/\nPrice,Matched Qty/\nPrice,Trd
    Curr/\nMatched Value,Account No/\nOrder No";
    var wid =
    "90,43.2699356842522,91.5969497381748,87.4747020181826,60.4473499934867,67.9851014914014, 90.2231829093762,111.8984058876167,134.104372277509";
    var alig = "left ,left, left , left , left , right , right ,
    right , left ";
    var halig = "center ,center,center , center , center , center
    , center , center , center ";
    var fxdata:Array = new Array();
    fxdata[0]= new Array("67676
    GPACKET","Buy","Expired","05/09/2007 06:04:20 PM","Day","200
    4.34","0 0.00","MYR 0.00","423423423432");
    fxdata[1]= new Array("054066
    FASTRAK","Buy","Expired","05/09/2007 01:45:18 PM","Day","47,900
    0.27","0 0.00","MYR 0.00","fdsfsdfsdf");
    fxdata[2]= new Array("737013
    HUBLINE","Sell","Expired","05/09/2007 11:53:19 AM","Day","400
    0.69","0 0.00","MYR 0.00","93743");
    fxdata[3]= new Array("31474
    L&G","Buy","Expired","03/09/2007 11:35:35 AM","Day","500
    0.70","0 0.00","MYR 0.00","389dskjfsd");
    fxdata[4]= new Array("38182
    GENTING","Buy","Expired","28/08/2007 11:38:59 AM","Day","500
    7.35","0 0.00","MYR 0.00","90sklsdakl");
    fxdata[5]= new Array("05005
    PALETTE","Buy","Expired","28/08/2007 11:08:23 AM","Day","500
    0.115","0 0.00","MYR 0.00","jsdaflk;as");
    fxdata[6]= new Array("093082
    GPACKET","Buy","Expired","27/08/2007 03:49:43 PM","Day","300
    3.82","0 0.00","MYR 0.00","jsdafj;sda");
    fxdata[7]= new Array("644769
    KELADI","Buy","Expired","27/08/2007 11:05:36 AM","Day","10,000
    0.30","0 0.00","MYR 0.00","jsadjf;lkdas");
    fxdata[8]= new Array("676653
    KASSETS","Buy","Expired","24/08/2007 06:15:33 PM","Day","500
    2.93","0 0.00","MYR 0.00","jlsdf;adas");
    fxdata[9]= new Array("473323
    JAKS","Buy","Expired","23/08/2007 04:45:03 PM","Day","100 0.915","0
    0.00","MYR 0.00","jjkljsdlfasd");
    fxdata[10]= new Array("03069
    IPOWER","Buy","Expired","22/08/2007 10:18:01 AM","Day","9,800
    0.365","0 0.00","MYR 0.00","jlajsd;lfjads");
    fxdata[11]= new Array("05025
    LNGRES","Buy","Expired","21/08/2007 03:08:06 PM","Day","9,900
    0.28","0 0.00","MYR 0.00","jlkjsdafl");
    fxdata[12]= new Array("01308 N2N","Buy","Expired","21/08/2007
    10:34:51 AM","Day","200 1.71","0 0.00","MYR 0.00","mjkjadsflasd");
    fxdata[13]= new Array("70069
    IPOWER","Buy","Cancelled","21/08/2007 10:02:08 AM","Day","0
    0.37","0 0.00","MYR 0.00","jkjasd;fsda");
    fxdata[14]= new Array("03069
    IPOWER","Buy","Cancelled","20/08/2007 07:20:54 PM","Day","0
    0.38","0 0.00","MYR 0.00","jkjsdlkfjsdaf");
    fxdata[15]= new Array("12651
    MRCB","Buy","Replaced","20/08/2007 05:31:59 PM","Day","900 2.35","0
    0.00","MYR 0.00","upuewoirwe");
    var mdtgrid:DataGrid;
    _root.createEmptyMovieClip("displayobj1",
    _root.getNextHighestDepth(),{_x:0,_y:0});
    initial();
    function initial(){
    _root.mdtgrid =
    _root.createClassObject(mx.controls.DataGrid, "xxx",
    _root.getNextHighestDepth());
    _root.mdtgrid.doLater(_root,"setData");
    function setData(){ //insert data to datagrid
    var temp:Array = new Array();
    for (var i in _root.fxdata){
    temp
    = new Object();
    for (var j in _root.fxdata){
    temp
    [j] = _root.fxdata[j];
    _root.mdtgrid.dataProvider =temp;
    _root.mdtgrid.doLater(_root,"setdgStyle");
    function setdgStyle(){
    var rowhight = 40;
    var noofrow = 8;
    var headerheight = 35;
    var gridheight = (rowhight * noofrow) + headerheight ;
    _root.mdtgrid.setSize(800, gridheight);
    _root.mdtgrid.rowHeight =rowhight;
    _root.setHeader(_root.header.split(","));
    _root.setWidth(_root.wid.split(","));
    _root.setAlign(_root.alig.split(","));
    _root.mdtgrid.invalidate();
    function setHeader(datasource:Array){ //set header label
    var leng:Number = _root.mdtgrid.columnCount;
    var sleng:Number = datasource.length;
    var temp:Object;
    for (i =0 ;i<leng;i++){
    if (i>=sleng){
    break;
    _root.mdtgrid.getColumnAt(i).headerText = datasource
    function setWidth(datasource:Array){ //set columns width
    var leng:Number = _root.mdtgrid.columnCount;
    var sleng:Number = datasource.length;
    var temp:Object;
    for (i =0 ;i<leng;i++){
    if (i>=sleng){
    break;
    _root.mdtgrid.getColumnAt(i).width = Number(datasource);
    function setAlign(datasource:Array){ //set Alignment
    var leng:Number = _root.mdtgrid.columnCount;
    var sleng:Number = datasource.length;
    var temp:Object;
    for (i =0 ;i<leng;i++){
    if (i>=sleng){
    break;
    temp = _root.mdtgrid.getColumnAt(i);
    temp.setStyle("textAlign",trim(datasource

    Anyone know how to fix it ?

  • Customizing DataGrid component in Flash CS3 using AS3

    Can anyone please explain how to customize the DataGrid
    component in Flash CS3 using AS3???
    How do you remove/change the grid lines for the rows and
    colums?
    How do you remove/change the border?
    My day has been lost searching for this answer. Flash
    Documentation is worthless and Google finds nothing with regards to
    AS3. ASDGRH.
    Thanks in advance,
    TedWeb

    I hope you've found a resolution to this by now, but I just noticed the discussion title when posting a captioning issue.
    In a nutshell, create a listener on your FLVPlayback module with a VideoEvent.SKIN_LOADED event. You'll also need to set the showCaptions in your FLVPlaybackCaptioning object to true. Apparently, if the captions are set to false when the player object loads the skin, the captions aren't recognized and your captions toggle will require an extra click to activate the captions.
    Here's the link to another discussion on the same topic with all of the details:
    http://kb2.adobe.com/cps/402/kb402452.html
    Also, have you had any issues with the caption button in the FLVPlayback skin not showing up? That's my current issue. Here's the discussion for it:
    http://forums.adobe.com/thread/796423?tstart=0

  • Passing Arrays to the DataGrid Component

    How's it going my peoples? I'm having some difficulties
    passing Arrays into a DataGrid Component. It just doesnt seem to
    work for me. Anyone have any ideas on the best way of doing this?
    Thank you in advance.

    We have Our site build using odp.net but suddenly it stoped working on the production server. MS Provider is working fine in that case. so we want to have one copy of solution with MS provider as backup copy so in future if any failure occurs to odp.net we can use this copy. So for that I need to know how to pass arrays to oracle using MS Provider.
    Regards,
    Suresh

  • NEWBIE: AS3/XML DataGrid Component interaction

    So heres the situation:
    I'm trying to create a simple newsreader using a Flash
    DataGrid component in which data is loaded via EXTERNAL XML
    attributes. And it works fine...got 2 columns, "subject" and "date
    posted", and the appropriate data being sent to the right place.
    So heres the problem:
    I'd like to link those rows, when the user clicks on any
    individual row, to load the "URL" attribute that the XML has
    defined. Feels like there's an easy solution but i just can't put
    my finger on it:
    Is this possible? Code below:
    < LexHead />

    Whay are you using a different formatted xml for the dummy
    than the real data. Using internal data for testing is a fine
    technique, but i needs to be the same format as the real data.
    Otherwise how will you know when you get the code right?
    I have an example that uses HTTPService to get an xml file
    from the server, uses a tree to display/edit the nodes, a dynamic
    dataGrid for displaying/editing the attributes, and HTTPService to
    send it back to the server. The backend is JSP, so to run that
    you'd need a J2EE web server like Tomcat, but the tree and property
    explorer might be useful.
    Semd me an email and I will send it to you directly.
    Tracy

  • Can any one have link where datagrid component

    can any one have link where datagrid component, ACTUALLY I
    WANT HERE that i have rendered checkbox component in datagrid &
    delete multiple rows of datagrid help?

    Hi Sairam, what do you want to do?
    1) You can to change language vendor in transaction xk02 with the vendor number and on Address screen you go to Communication tab and change the language there.
    2) You can put the currency of vendor on Purchasing data screen in the same transaction
    I wish that this information help you
    Rose

  • Custom Sort (by date) in a DataGrid component

    So I've got a data grid component hooked up to a data provider like so:
    var weekData:XML=// some xml loaded in earlier....
    var weekGrid:DataGrid=new DataGrid();
    var dataProvider:DataProvider=new DataProvider();
    for each(var entry:XML in weekData){
         dp.addItem({event:entry.title,date:FormatDate.format(new Date(entry.@startDate),5),data:entry.@startDate});
    The title column is just what you might think. The date colum is actually a format like May 2012 or Feb 2013. And the data "column" isn't actually shown in the dataGrid it is the "key" for sorting by date. It contains the getTime() value of the date like 1328515200000. So that will make date sorting just a case of Array.NUMERIC with the appropriate Array.DESCENDING when needed.
    I've found that if I do this:
    weekGrid.dataProvider.sortOn("data",Array.NUMERIC)
    weekGrid.invalidate();
    it works and the grid is sorted -- IF I have some other button to click to cause that code to run.
    I want to tie it together with the click event on the grid header. Thusly:
    weekGrid.addEventListener(DataGridEvent.HEADER_RELEASE,sortDataGrid);
    And I've getting the event and all, but evidently that is fireing off the built-in sorting which happens after mine. And it doesn't do what I want.
    Any idea how to stop that and allow my perferred sorting to take place?

    if you don't want the user to sort your datagrid, use:
    weekGrid.sortableColumns = false;
    and execute your sort without clicking anything.  or use:
    weekGrid.addEventListener(DataGridEvent.HEADER_RELEASE,sortDataGrid);
    function sortDataGrid(e:DataGridEvent):void{
        setTimeout(sortF,100);
    function sortF():void{
        weekGrid.dataProvider.sortOn("data",Array.NUMERIC)

  • Flex DataGrid Component

    Can i extend the Flex DataGrid using ActionScript and create as  Add-On Component ?

    I've been trying to get this to work.  But i'm having issues   Not sure if it's related to the Array binding limitation mentioned in the release notes.  Maybe someone else has some ideas.
    I'm trying to bind to the dataProvider property of the DataGrid.  That way when the user in Xcelsius selects a range, it will bind the data in the excel sheet to the DataGrid.
    Problem is that i'm only getting one value to update (specifically the top value).  At this time i'm only trying to bind a single column of data.
    I noted that the commitProperties function gets called whenever a cell changes that i'm bound to, but the dataProvider is only receiving the first value of the array.  Even odder is that the ArrayCollection that i receive simply looks like this:
    commitProp:dataProvider=(mx.collections::ArrayCollection)#0
      filterFunction = (null)
      length = 1
      list = (mx.collections::ArrayList)#1
        length = 1
        source = (Array)#2
          [0] 1
        uid = "A37C62CC-F3DC-E1B1-8159-CE984C2CCE33"
      sort = (null)
      source = (Array)#2
    So i see that i get an array collection of ArrayList objects, the first one of which simple contains the value in the excell sheet "1".
    I noted that the proxy.bind function has a parameter called "chain", maybe this is what i need to get multiple value binding?  The documentation for the calls are pretty basic, which is understandable as this is new technology.
    So anyone have some ideas?  Maybe someone from BO who is apart of the SDK group can comment?

  • Prebleme avec datagrid component dropdownlist  et update dababase

    Bonjour,
    je travaille avec j2ee/flex.j'ai realisé une datagrid qui est remplie pas des données depuis la base de données et qui contient de plus un DataGridColumn ou j'ai definitun component DropDownList.ce component est rempli depuis la base de données aussi grace au script et l'ensemble declaration des services.le probleme et que je dois affecter a chaque persoonnele une academie choisie depuis le component drop DropDownListet l'enrigistrer dans la base de donné.voici mon code:
    <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:services="services.*" xmlns:skins="arcade.skins.*" > <fx:Style source="projet2.css"/> <fx:Script> <![CDATA[ import mx.controls.Alert; import mx.events.FlexEvent;  import spark.events.IndexChangeEvent;     protected function dataGrid_creationCompleteHandler(event:FlexEvent):void { listePersoResult.token = personnelServiceImpl.listePerso(); }     ]]> </fx:Script> <fx:Declarations> <s:CallResponder id="listePersoResult"/> <services:PersonnelServiceImpl id="personnelServiceImpl" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"> <services:channelSet> <s:ChannelSet> <s:AMFChannel uri="htttp://localhost:8080/GENIE1/messagebroker/amf"/> </s:ChannelSet> </services:channelSet> </services:PersonnelServiceImpl>     </fx:Declarations> <mx:DataGrid x="10" y="37" id="dataGrid" creationComplete="dataGrid_creationCompleteHandler(event)" dataProvider="{listePersoResult.lastResult}"> <mx:columns> <mx:DataGridColumn headerText="iduser" dataField="iduser"/> <mx:DataGridColumn headerText="prenomPers" dataField="prenomPers"/> <mx:DataGridColumn headerText="idPer" dataField="idPer"/> <mx:DataGridColumn headerText="Academie"> <mx:itemRenderer> <fx:Component> <mx:HBox> <fx:Script> <![CDATA[ import mx.controls.Alert; import mx.events.FlexEvent; import spark.events.IndexChangeEvent; protected function dropDownList_creationCompleteHandler(event:FlexEvent):void { listeAcademieResult.token = academieServiceImpl.listeAcademie(); }  ]]> </fx:Script>  <fx:Declarations> <services:AcademieServiceImpl id="academieServiceImpl" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"> <services:channelSet> <s:ChannelSet> <s:AMFChannel uri="htttp://localhost:8080/GENIE1/messagebroker/amf"/> </s:ChannelSet> </services:channelSet> </services:AcademieServiceImpl>  <s:CallResponder id="listeAcademieResult"/> </fx:Declarations>   <s:DropDownList x="108" y="224" id="dropDownList" creationComplete="dropDownList_creationCompleteHandler(event)" labelField="intituleAcad"> <s:AsyncListView list="{listeAcademieResult.lastResult}"/> </s:DropDownList> </mx:HBox> </fx:Component> </mx:itemRenderer> </mx:DataGridColumn> </mx:columns> </mx:DataGrid>  </s:Application>
    le probleme est ou definir mon bouton et comment mettre a jour ma base de donnée en cliquant sur ce bouton avec l'ensembe des valeurs selectionnés dans le dropdownlist.j'utilise hubernate et spring.

  • How to display HyperLink on the DataGrid Component  column  data.

    Hi ,
    I am able to display customer data on to the DataGrid with the help of a ArrayCollection,
    Similar as shown :
    <mx:columns>
    <mx:DataGridColumn dataField="customerid"  headerText="Employee ID"
                       itemRenderer=""/> 
          </mx:columns>
    Please tell me what should be the value inside the itemRenderer to make the customerid display as an HyperLink ??
    I am struck up mx.controls.----?? value on to the itemRenderer 
    Please suggest .
    Thanks in advance .

    And Following is answer for http://forums.adobe.com/thread/630928?tstart=0
    <mx:DataGridColumn headerText="Employee ID"
    editorDataField="text" dataField="customerid"
    itemRenderer="mx.controls.TextInput" editable="true"/>
    Just replace TextInput--->YPaticular  controll(LinkButton)
    please help to answer this
    http://forums.adobe.com/thread/630962
    Happy codding....

  • First row trouble with datagrid component

    Dear all,
    I think my question is entirely explained in the topic
    summary of this post. I have a datagrid that uses a item renderer.
    The main app is defined like in the first part of the attached
    code. The itemrenderer looks like the second part of the attached
    code.
    When I run it, the first item of my dataprovider is not shown
    while the first line of my datagrid is always empty... Any idea to
    explain this strange behavior ?
    Thanks in advance...

    Hi WAV;
    You might have better luck posting over in the Front Row Forum.
    Allan

  • CS3 Datagrid Component

    There has to be some way to get an html link to work in a CS3
    Datagrid. I can't find anything on html links using Flash CS3 and
    Actionscript 3, which seems pretty remarkable to me. I'm surprised
    Adobe didn't code the datagrid to recognize when an html link is
    being clicked in the grid.
    I've spent the last couple of days trying to do this with no
    success. I've emailed Adobe and received no response.
    Has anyone successfully gotten an html link to work in a CS3
    Datagrid? If so, please share.

    There has to be some way to get an html link to work in a CS3
    Datagrid. I can't find anything on html links using Flash CS3 and
    Actionscript 3, which seems pretty remarkable to me. I'm surprised
    Adobe didn't code the datagrid to recognize when an html link is
    being clicked in the grid.
    I've spent the last couple of days trying to do this with no
    success. I've emailed Adobe and received no response.
    Has anyone successfully gotten an html link to work in a CS3
    Datagrid? If so, please share.

  • Datagrid itemRenderer custom component formatting

    OK, so this is my first attempt at an itenRenderer. This works below, but I have to imagine there is an easier way. There is also a problem with below, where the changed field (datafield=side) after the itemRenderer is applied, the text is all out of format, and there is a kind of selection on row one of that column. Obvisouly, though the translation is happening, I'm either overidding the wrong thing, or I'm doing something totally wrong.
    Goal..... Show in the datagrid, the three colums below from date provided from elsewhere. (This all works), but in the 'side' data it comes in, in raw form as either an 'a' or 'b' or 'both', and I'm trying to display that as something more user friendly. So when both is read it changes it to 'No'.
    Any help. This seems really easy, though I can't understanading hy my custom function screws with the cell selection, and formating?
    ---Main program---
    <mx:DataGrid x="10" y="9" width="199" height="147" id="gdimmer_checkChannel" dataProvider="{ current_rack.getItemAt(0).rackLevels }"
      change="dimmerCheckCurrentSelection(event);"
      sortableColumns="false"
      selectedIndex="{ current_rack.getItemAt(0).currentCheckIndex }" >
    <mx:columns>
      <mx:DataGridColumn headerText="UDN" dataField="udn"/>
      <mx:DataGridColumn headerText="DD" dataField="side" editable="false" itemRenderer="renderers.DataGridDDSide"/>
      <mx:DataGridColumn headerText="Circuit" dataField="circuit"/>
    </mx:columns>
    </mx:DataGrid>
    --- Component Below ---
    <?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">
    <s:Label id="lblData" text="{dataGridListData.label}" />
    <fx:Script>
    <![CDATA[
      override public function set data(value:Object):void
        if (value.side == 'both') { lblData.text = "  No" };
       if (value.side == 'a') { lblData.text = "  a" };
       if (value.side == 'b') { lblData.text = "  b" };
    ]]>
    </fx:Script>
    </s:MXDataGridItemRenderer>

    See the latest post on my blog.  You also need to set super.data in the data
    setter.
    Alex Harui
    Flex SDK Team
    Adobe System, Inc.
    http://blogs.adobe.com/aharui

  • Datagrid rearranging columns?

    I'm having a problem. This code i have written will import
    the XML but it rearranges the fields when i do this:
    "for (var subKey:String in data[0])"
    All of the fields come through but the subKey order is not in
    the order of the actual XML. Is there any way to get the
    "$ColumnNames[$w]" var from php over to flex in the same order?
    I don't know if i just reinvented the wheel, but it was
    definitely a good learning experience.
    MXML is first then PHP is second. Some of the code is copied
    off other examples. I didn't see any copyrights but let me know if
    there are any problems. O and the error thing doesn't work on the
    PHP page.

    I am look for a solution to a similar problem.
    I've got this nice little .fla that displays a DataGrid component (Flash CS3 Professional) using a DataProvider created from XML loaded from URLRequest/URLLoader (.asp source, but could be PHP, etc.).
    It works great except for one little annoying item.  The order of the columns seems to be totally arbitrary.
    I was expecting the order of the column to be the same as they occur in the XML DATA element.
    Here is a sample DATA element (there are serveral such DATA elements in the XML:
    <DATA>
      <AreaID>TNV</AreaID>
      <AreaName>TN, VA</AreaName>
      <MaxDvrHT>4</MaxDvrHT>
      <BoardName>TN, VA</BoardName>
      <RegionName>SOUTHEAST</RegionName>
      <salesGroup>David</salesGroup>
    </DATA>
    Here is the function that builds DataGrid:
    function returnAJAXcallback(evtObj:Event):void{
    // executed by URLLoader event listener "complete"
    // load the XML returned from .asp into XML object
    var myXML:XML = XML(evtObj.target.data);   
    // create a data provider from the XML
    var myDP = new DataProvider(myXML);  
    // create a DataGrid
    var myDataGrid:DataGrid = new DataGrid;  
    // set the data provider
    myDataGrid.dataProvider=myDP;   
    myDataGrid.width = 900;
    myDataGrid.height = 500;
    // show DataGrid on stage
    addChild(myDataGrid);     
    for each (var child:XML in myXML.DATA) {
      trace(child) ;  // list each DATA segment
    Here is the order that the columns appear in the DataGrid (left to right):
    AreaName
    RegionName
    salesGroup
    AreaID
    MaxDvrHT
    BoardName
    So, how in the world does Flash come up with this order?
    Why not default to the order in which the columns appear in the XML?
    Now, if some nice person knows the answer (I'm pretty new to Flash), what do I need to do (with as little code as possible) to get the columns ordered in a similar fashion to the order in which the XML data elements appear?
    Thanks to all.

  • Refresh Datagrid After Popup Data Edit

    Hi all,
    I'm fairly new to flex development, so please keep that in mind when trying to help... I may ask some really stupid questions!
    Basically what I'm trying to do is to refresh the source data of a datagrid ONLY when the popup window that I'm using to add/edit/delete records is closed.
    I have successfully captured WHEN the window closes... I can see the event happening in my datagrid component.  I used an Alert.show() to prompt me after the popup closes and the datagrid captures the close event.
    What I can't figure out for the life of me is how to refresh the datagrid's source data, when that source data is being called & populated from a "parent" component.
    How it works is like this...
    Search Component (6 drop down menus & 1 text input)
    |___Datagrid (displays all records by default, only records meeting search criteria upon clicking the "search" button)
      |______Popup window editor (this is called by passing the "ID" of the record I want to take action on into the popup window using a public variable when a user DOUBLE CLICKS a value in the datagrid)
    So let's say for instance you are looking at customer A.  Customer A's record loads into the popup window... and then let's say you want to delete that record for whatever reason.  Currently, when you click the "Delete Record" button in my application, the popup window closes, and from the looks of things, it dispatches the close event properly.  (I added an event listener to the datagrid component when I instantiated it in the search component), so when the popup window closes, the event listener fires and I have an Alert to tell me that yes, the close event was dispatched.
    I think I know "What" I'm doing wrong, but I don't know how to go about changing it to make it work.  Basically because the datagrid is populated IN the search component from an arraycollection, my attempts to "Refresh" the data in the datagrid component which captures the close event of the popup window won't work because the datagrid component has no visibility to the arraycollection used in the search component to populate said datagrid component.
    I know that the record is being deleted, as if I actually click the "search" button again, the record does disapear from the datagrid.  How do I force that to happen automagically when the popup form closes?
    I can provide a code refernce if I need to... gonna take a bit though as alot of what I've built has references to client's data which I'd have to remove.
    If anyone could provide some insight here, or a direction I would appreciate it.  I've looked at a number of solutions so far, and I've not had luck with any of them.

    Hi all,
    I'm fairly new to flex development, so please keep that in mind when trying to help... I may ask some really stupid questions!
    Basically what I'm trying to do is to refresh the source data of a datagrid ONLY when the popup window that I'm using to add/edit/delete records is closed.
    I have successfully captured WHEN the window closes... I can see the event happening in my datagrid component.  I used an Alert.show() to prompt me after the popup closes and the datagrid captures the close event.
    What I can't figure out for the life of me is how to refresh the datagrid's source data, when that source data is being called & populated from a "parent" component.
    How it works is like this...
    Search Component (6 drop down menus & 1 text input)
    |___Datagrid (displays all records by default, only records meeting search criteria upon clicking the "search" button)
      |______Popup window editor (this is called by passing the "ID" of the record I want to take action on into the popup window using a public variable when a user DOUBLE CLICKS a value in the datagrid)
    So let's say for instance you are looking at customer A.  Customer A's record loads into the popup window... and then let's say you want to delete that record for whatever reason.  Currently, when you click the "Delete Record" button in my application, the popup window closes, and from the looks of things, it dispatches the close event properly.  (I added an event listener to the datagrid component when I instantiated it in the search component), so when the popup window closes, the event listener fires and I have an Alert to tell me that yes, the close event was dispatched.
    I think I know "What" I'm doing wrong, but I don't know how to go about changing it to make it work.  Basically because the datagrid is populated IN the search component from an arraycollection, my attempts to "Refresh" the data in the datagrid component which captures the close event of the popup window won't work because the datagrid component has no visibility to the arraycollection used in the search component to populate said datagrid component.
    I know that the record is being deleted, as if I actually click the "search" button again, the record does disapear from the datagrid.  How do I force that to happen automagically when the popup form closes?
    I can provide a code refernce if I need to... gonna take a bit though as alot of what I've built has references to client's data which I'd have to remove.
    If anyone could provide some insight here, or a direction I would appreciate it.  I've looked at a number of solutions so far, and I've not had luck with any of them.

Maybe you are looking for

  • Display issue in IE

    Hi All; the test page at http://www.windycitycarpets.com/index2a.html displays fine  in FireFox but in IE the content in apDiv3 is pushed down to the bottom of  the page. How do I correct that ? Thanks; Pat

  • Parameter in HTTP receiver adapter

    Hey My requirements are: I am sending an XML to an external system. Documentation says: "XML should be in a parameter in your request called 'xmlInput'". How do I actually put my XML in this parameter? Does this have anything to do with the URL Param

  • 1/3 of Display is ok 2/3 don`t show a picture

    Hello My Powerbook has broken Display hinges. With an external Monitor the Powerbook works fine. I opend the Display and put in the cable (pulled out when the Display hinges get broken). The upper third (horizontal) show the normal picture, the other

  • To Adobe, Are We Going to See a Fixed Encore CS5?

    I am posting this as a long time Adobe user.  I have installed the CS5 suite and am using Encore CS4 because when I import pre-encoded Blu-ray assets into Encore CS5 it says the disc is full.  The assets are not too large to fit on a Blu-ray. I see a

  • Use of saved credentials

    I know I can Get-Credential and use the object for things like creating a scheduled task, or using Invoke-Command on another machine. And I know I believe I can save that Credential to file for later use as well. But, is there any way to run an arbit