Flex 4 - Datagrid add checkbox to a column

Hello all.
I am trying to add a checkbox to a datagrid column, so that i can use it to delete a record from the array.  My datagrid is as follows
    <mx:DataGrid x="10" y="40" width="903" dataProvider="{questionsArr}" sortableColumns="false" draggableColumns="false" editable="true">
        <mx:columns>
            <mx:DataGridColumn headerText="No." dataField="Number" width="100" editable="false"/>
            <mx:DataGridColumn headerText="Question" dataField="Question" />
            <mx:DataGridColumn headerText="Delete"  width="100" />
        </mx:columns>
    </mx:DataGrid>
The user inputs questions into the array via a textinput box.
But what i want to do is add a checkbox to the "Delete" column.  If anyone could help me with this that would be great !

Ok, thanks both for your answers.
I have now gone about doing it the following way:
    <mx:DataGrid x="10" y="40" width="903" dataProvider="{questionsArr}" sortableColumns="false" draggableColumns="false" editable="true">
        <mx:columns>
            <mx:DataGridColumn headerText="No." dataField="Number" width="100" editable="false"/>
            <mx:DataGridColumn headerText="Question" dataField="Question" />
            <mx:DataGridColumn headerText="Delete"  width="100">
                    <mx:itemRenderer>
                        <fx:Component>
                            <mx:HBox horizontalAlign="center" verticalAlign="middle">
                                <s:CheckBox/>
                            </mx:HBox>
                        </fx:Component>
                    </mx:itemRenderer>
            </mx:DataGridColumn>
        </mx:columns>
    </mx:DataGrid>
It works fine, as i add a question, a checkbox gets added to the Delete column.  Alls great.
But when i come to click on the checkbox, the following text gets displayed [object Object]
Then when i click away from the checkbox the checkbox reappears.  With it either selected or unselected depending on what value it should be.
Is there anyway so that it dosent display the [object Object] ?

Similar Messages

  • Datagrid with checkbox in its column

    In my application I have a datagrid (a custom datagrid -
    CheckBoxDatagrid), whose first colum contains checkbox as
    itemrenderer. There is another column (Latest Version) - this
    column can have two values either "Available" or "Update".
    The requirement here is that, when the page is getting loaded
    then depending on the value of the column "Latest Version" the
    checkboxes will have to be loaded. If the value of the coluem is
    "Available", then the checkbox corresponding to that row should get
    automatically selected as soon as the page gets loaded.
    I am attaching the code snippet below,
    <configure:CheckBoxDataGrid id="swDataGrid"
    initialize="swDataGrid.dataProvider=MaintenanceViewController.softwareList"
    alternatingItemColors="[#ffffff, #ffffff]" paddingLeft="10"
    paddingRight="5"
    allowMultipleSelection="true" width="95%" height="60%"
    paddingBottom="5" selectionColor="#1b77b7"
    verticalGridLines="false"
    creationComplete="{MaintenanceViewController.checkBoxSelect()};">
    <configure:columns>
    <mx:DataGridColumn id="checkBox" dataField="softwarename"
    textAlign="center" headerText=" " width="20" sortable="false"
    itemRenderer="com.pmc.view.tasks.wizard.CheckBoxRenderer"
    editable="false">
    </mx:DataGridColumn>
    <mx:DataGridColumn id="swName" headerText="Software Name"
    dataField="softwarename" width="130"/>
    <mx:DataGridColumn id="cVersion" headerText="Current
    Version" dataField="currentversion" width="80"/>
    <mx:DataGridColumn id="updStatus" headerText="Update
    Status" dataField="updateStatus" width="80"/>
    </configure:columns>
    </configure:CheckBoxDataGrid>
    where, configure = defined namespace.

    "BlueRHBA" <[email protected]> wrote in
    message
    news:go0hkf$2kt$[email protected]..
    > In my application I have a datagrid (a custom datagrid -
    > CheckBoxDatagrid),
    > whose first colum contains checkbox as itemrenderer.
    There is another
    > column
    > (Latest Version) - this column can have two values
    either "Available" or
    > "Update".
    >
    > The requirement here is that, when the page is getting
    loaded then
    > depending
    > on the value of the column "Latest Version" the
    checkboxes will have to be
    > loaded. If the value of the coluem is "Available", then
    the checkbox
    > corresponding to that row should get automatically
    selected as soon as the
    > page
    > gets loaded.
    >
    > I am attaching the code snippet below,
    What is your question? Or are you looking to hire someone to
    fulfill your
    requirement?

  • Add checkbox to listview column in vba

    Hello, I have a listview, and would like to add a column containing a checkbox, and tried to do this, but the only thing I've done is insert the checkbox in the first column, I would like to be inserted at the last, I hope you can help me, Greetings

    You didn't say which listview you are using but typically you can only add a checkbox (or icon) to the main item in the first column. However normally you can reorder the entire first column and place it in whichever position you want.
    Maybe you might need to put the contents of the last column in the first column and shift the contents of all the others one to the right. Depending on your listview maybe something like this
    myList.ColumnHeaders(1).Position = myList.ColumnHeaders.Count
    You can change the order as soon as you have added the headers (before or after adding the items)

  • How to add Column to Adobe flex mx:DataGrid in mxml and/or actionsctpt?

    I have simple mxml code
    <mx:DataGrid id="DGG"
                 editable="true">
        <mx:dataProvider>
            <mx:Object scheduledDate="4/1/2006"/>
        </mx:dataProvider>
    </mx:DataGrid>
    <mx:Button id="SetBut"
               label="Set Array as Data Provider"
               click="SetDP(); AddBut.visible = true;"
               x="100.5"
               y="164"
               width="211"/>
    <mx:Button id="AddBut"
               label="Add a column!"
               click="AddCol();"
               x="100.5"
               y="194"
               width="211"
               visible="false"/>
    <mx:Script>
        <![CDATA[
            import mx.controls.dataGridClasses.DataGridColumn;
            import mx.collections.ArrayCollection;
            [Bindable]
            public var MyAC:ArrayCollection=new ArrayCollection([{scheduledDate: "4/1/2006", homeTeam: "Chester Bucks"}]);
            public function SetDP():void
                DGG.dataProvider=MyAC
            public function AddCol():void
                MyAC.addItem({scheduledDate: "4/5/2007", homeTeam: "Long Valley Hitters", Umpire: "Amanda Hugenkis"});
                DGG.columns.push(new DataGridColumn("Umpire"));
        ]]>
    </mx:Script>
    I want to add rows to my table datagrid how to do such thing?
    How to add Column to Adobe flex mx:DataGrid in mxml and/or actionsctpt?
    (You can put this code in Flash or AIR app - it will compile with no errors, but will not add any columns=( )

    Change this:
                 public function SetDP():void
                    DGG.dataProvider=MyAC
                    MyAC.addItem({scheduledDate: "4/5/2007", homeTeam: "Long Valley Hitters", Umpire: "Amanda Hugenkis"});
                public function AddCol():void
                    var dgc:DataGridColumn = new DataGridColumn("Umpire");
                    var ca:Array = DGG.columns;
                    ca.push(dgc);
                    DGG.columns = ca;
    Dany

  • Flex Spark DataGrid BUG skipping rows on refresh

    I have a small one file example that demonstrates this Flex DataGrid bug.
    I tried to report it to Flex bugs and the page timed out.
    I am filling a column in a spark datagrid with checkboxes to select that row.
    In the header of that column is a checkbox to select ALL the rows.
    However, the middle row is not getting refreshed so the display is wrong.
    The checkbox looks empty when the backing value is correct.
    I have added a print to the code that sets the values in the data and it is setting everyone.
    But when I print the isSelected code it is NOT being called on ONE (the middle) visible row.
    If I move away or scroll up and down the check box shows the check mark.
    So My only conclusion is that refresh has a bug.
    Here is the example that demonstrates the problem.
    Simply select the header checkbox and the 3rd checkbox does not get updated on refresh.
    <?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">
              <fx:Script>
                        <![CDATA[
                                  import mx.collections.ArrayCollection;
                                  private static var values:Array = [
                                            {selected: false, position: 1},
                                            {selected: false, position: 2},
                                            {selected: false, position: 3},
                                            {selected: false, position: 4},
                                            {selected: false, position: 5}
                                  [Bindable]
                                  public static var datalist:ArrayCollection = new ArrayCollection( values );
                                  public static function updateDataList( value:Boolean ):void
                                            for each( var item:Object in datalist ) {
                                                      trace( "updated: " + item.position );
                                                      item.selected = value;
                                            datalist.refresh();
                        ]]>
              </fx:Script>
              <s:DataGrid dataProvider="{datalist}">
                        <s:columns>
                                  <s:ArrayList>
                                            <s:GridColumn dataField="position" width="200"/>
                                            <s:GridColumn width="34" >
                                                      <s:itemRenderer>
                                                                <fx:Component>
                                                                          <s:GridItemRenderer textAlign="center">
                                                                                    <fx:Script>
                                                                                              <![CDATA[
                                                                                                        private function changeSelection( data:Object, event:MouseEvent ):void
                                                                                                                  data.selected = ! data.selected;
                                                                                                        private function isSelected( data:Object ):Boolean
                                                                                                                  trace( "isSelected: " + data.position );
                                                                                                                  return data.selected;
                                                                                              ]]>
                                                                                    </fx:Script>
                                                                                    <s:layout>
                                                                                              <s:HorizontalLayout horizontalAlign="center" verticalAlign="middle"/>
                                                                                    </s:layout>
                                                                                    <s:CheckBox id="selbox" label="" selected="{isSelected(data)}"
                                                                                                                  click="changeSelection(data, event)"/>
                                                                          </s:GridItemRenderer>
                                                                </fx:Component>
                                                      </s:itemRenderer>
                                                      <s:headerRenderer>
                                                                <fx:Component>
                                                                          <s:GridItemRenderer height="30">
                                                                                    <fx:Script>
                                                                                              <![CDATA[
                                                                                                        [Bindable]
                                                                                                        private static var selectAll:Boolean = false;
                                                                                                        private function changeAllSelection( event:MouseEvent ):void
                                                                                                                  selectAll = ! selectAll;
                                                                                                                  Main.updateDataList( selectAll );
                                                                                              ]]>
                                                                                    </fx:Script>
                                                                                    <s:layout>
                                                                                              <s:VerticalLayout horizontalAlign="center" verticalAlign="middle"/>
                                                                                    </s:layout>
                                                                                    <s:CheckBox label="" selected="{selectAll}"
                                                                                                                  click="changeAllSelection(event)"/ >
                                                                          </s:GridItemRenderer>
                                                                </fx:Component>
                                                      </s:headerRenderer>
                                            </s:GridColumn>
                                  </s:ArrayList>
                        </s:columns>
              </s:DataGrid>
    </s:Application>
    Here is an image of the failed result... after selecting the top checkbox.
    Below is an image of the output produced by the two traces.
    Notice that the refresh has not called isSelected on the 3rd element.

    I have a small one file example that demonstrates this Flex DataGrid bug.
    I tried to report it to Flex bugs and the page timed out.
    I am filling a column in a spark datagrid with checkboxes to select that row.
    In the header of that column is a checkbox to select ALL the rows.
    However, the middle row is not getting refreshed so the display is wrong.
    The checkbox looks empty when the backing value is correct.
    I have added a print to the code that sets the values in the data and it is setting everyone.
    But when I print the isSelected code it is NOT being called on ONE (the middle) visible row.
    If I move away or scroll up and down the check box shows the check mark.
    So My only conclusion is that refresh has a bug.
    Here is the example that demonstrates the problem.
    Simply select the header checkbox and the 3rd checkbox does not get updated on refresh.
    <?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">
              <fx:Script>
                        <![CDATA[
                                  import mx.collections.ArrayCollection;
                                  private static var values:Array = [
                                            {selected: false, position: 1},
                                            {selected: false, position: 2},
                                            {selected: false, position: 3},
                                            {selected: false, position: 4},
                                            {selected: false, position: 5}
                                  [Bindable]
                                  public static var datalist:ArrayCollection = new ArrayCollection( values );
                                  public static function updateDataList( value:Boolean ):void
                                            for each( var item:Object in datalist ) {
                                                      trace( "updated: " + item.position );
                                                      item.selected = value;
                                            datalist.refresh();
                        ]]>
              </fx:Script>
              <s:DataGrid dataProvider="{datalist}">
                        <s:columns>
                                  <s:ArrayList>
                                            <s:GridColumn dataField="position" width="200"/>
                                            <s:GridColumn width="34" >
                                                      <s:itemRenderer>
                                                                <fx:Component>
                                                                          <s:GridItemRenderer textAlign="center">
                                                                                    <fx:Script>
                                                                                              <![CDATA[
                                                                                                        private function changeSelection( data:Object, event:MouseEvent ):void
                                                                                                                  data.selected = ! data.selected;
                                                                                                        private function isSelected( data:Object ):Boolean
                                                                                                                  trace( "isSelected: " + data.position );
                                                                                                                  return data.selected;
                                                                                              ]]>
                                                                                    </fx:Script>
                                                                                    <s:layout>
                                                                                              <s:HorizontalLayout horizontalAlign="center" verticalAlign="middle"/>
                                                                                    </s:layout>
                                                                                    <s:CheckBox id="selbox" label="" selected="{isSelected(data)}"
                                                                                                                  click="changeSelection(data, event)"/>
                                                                          </s:GridItemRenderer>
                                                                </fx:Component>
                                                      </s:itemRenderer>
                                                      <s:headerRenderer>
                                                                <fx:Component>
                                                                          <s:GridItemRenderer height="30">
                                                                                    <fx:Script>
                                                                                              <![CDATA[
                                                                                                        [Bindable]
                                                                                                        private static var selectAll:Boolean = false;
                                                                                                        private function changeAllSelection( event:MouseEvent ):void
                                                                                                                  selectAll = ! selectAll;
                                                                                                                  Main.updateDataList( selectAll );
                                                                                              ]]>
                                                                                    </fx:Script>
                                                                                    <s:layout>
                                                                                              <s:VerticalLayout horizontalAlign="center" verticalAlign="middle"/>
                                                                                    </s:layout>
                                                                                    <s:CheckBox label="" selected="{selectAll}"
                                                                                                                  click="changeAllSelection(event)"/ >
                                                                          </s:GridItemRenderer>
                                                                </fx:Component>
                                                      </s:headerRenderer>
                                            </s:GridColumn>
                                  </s:ArrayList>
                        </s:columns>
              </s:DataGrid>
    </s:Application>
    Here is an image of the failed result... after selecting the top checkbox.
    Below is an image of the output produced by the two traces.
    Notice that the refresh has not called isSelected on the 3rd element.

  • Check all checkboxes in a column of a tabular form

    Hi,
    I think this can be useful for some people.. I have a tabular form with several columns containing checkboxes. I wanted to be able to check or uncheck a whole column. The problem is that I didn't find a function to do this. So I modified (and renamed) the $f_CheckFirstColumn(pNd) function.
    In "edit page > JavaScript Function and Global Variable Declaration", add this :
    function $f_CheckNthColumn(c,n){
         var e=$x_UpTill(c,"TABLE");
         for(var d=0,a=e.rows.length;d<a;d++){
              var b=$x_FormItems(e.rows[d],"CHECKBOX")[n];
              if(b){
                   if(b.checked != c.checked) {
                        b.click();
         return;
    }EDIT : The status of the checkboxes checked with the function below is not passed when submitting the form (it is passed when clicking on every checkbox). This is why I had to use the click() function (so that onClick is triggered).
    --function $f_CheckNthColumn(c,n){
         var e=$x_UpTill(c,"TABLE");
         var f=[];
         for(var d=0,a=e.rows.length;d<a;d++){
              var b=$x_FormItems(e.rows[d],"CHECKBOX")[n];
              if(b){
                   f[f.length]=b;
         $f_CheckAll(false,c.checked,f);
         return f;
    And in the report column header :
    <input type="checkbox" onClick="$f_CheckNthColumn(this, NUMBER);" />NUMBER being the column number (1st column containing checkboxes = 0, 2nd column containing checkboxes = 1, etc.)
    I'm using APEX 4.1.1.00.23, so I can not guarantee It'll work on other versions.
    Hope this can help !
    Edited by: ben0123 on Jul 13, 2012 12:12 AM
    Edited by: ben0123 on Jul 13, 2012 1:17 AM

    Glad it helped :)
    If you have only one checkbox that is conditional, you could change the $f_CheckNthColumn function by adding this kind of condition :
    if ($x_FormItems(e.rows[d],"CHECKBOX").length == max_number_of_checkboxes || n < position_of_conditional_checkbox) toggle checkbox(n); // all the checkboxes are displayed, or the nth checkbox is before the conditional checkbox
    else // one (or more?) checkbox is missing
      if (n == position_of_conditional_checkbox) do nothing;
      else toggle checkbox(n-1);

  • How to Add Checkbox and icon in ALVGRID

    Hi Experts,
      i have one Requirement. i need to add Checkbox, Selectall,icon(Unlock or inactive) infront of Contracts of ALV GRID.How to achive that.
    Thanks,
    Venkat.

    Hi
    For check box
    At declaring field catalog using structure LVC_S_FCAT
    mark CHECKBOX = 'X' and also EDIT = 'X'.
    For reference check below subroutine in program BCALV_EDIT_05.
    form build_fieldcat changing pt_fieldcat type lvc_t_fcat.
    data ls_fcat type lvc_s_fcat.
    call function 'LVC_FIELDCATALOG_MERGE'
    exporting
    i_structure_name = 'SFLIGHT'
    changing
    ct_fieldcat = pt_fieldcat.
    *§A2.Add an entry for the checkbox in the fieldcatalog
    clear ls_fcat.
    ls_fcat-fieldname = 'CHECKBOX'.
    * Essential: declare field as checkbox and
    * mark it as editable field:
    ls_fcat-checkbox = 'X'.
    ls_fcat-edit = 'X'.
    * do not forget to provide texts for this extra field
    ls_fcat-coltext = text-f01.
    ls_fcat-tooltip = text-f02.
    ls_fcat-seltext = text-f03.
    * optional: set column width
    ls_fcat-outputlen = 10.
    append ls_fcat to pt_fieldcat.
    endform.
    For Icon:
    CONSTANTS:
         icon_id_failure            LIKE icon-id   VALUE ' ((Content component not found.)) @',
         icon_id_okay              LIKE icon-id   VALUE ' ((Content component not found.)) @'.
    TYPES: BEGIN OF ls_tab,
           matnr LIKE equi-matnr,
           maktx LIKE makt-maktx,
           b_werk  LIKE equi-werk,
           b_lager LIKE equi-lager,
           lgobe LIKE t001l-lgobe,
           sernr LIKE equi-sernr,
           icon LIKE icon-id,
           objnr LIKE equi-objnr,
          END OF   ls_tab.
    *Table that display the data for the ALV.
    DATA: itab  TYPE ls_tab OCCURS 0 WITH HEADER LINE.
        PERFORM get_h_date .
        IF h_date => sy-datum .
          itab-icon = icon_id_okay.
        ELSE .
          itab-icon = icon_id_failure.
         ENDIF.
    Regards
    Sudheer

  • Flex 3 DataGrid Cross rollover issue

    Flex 3 DataGrid Control - How can i set cross rollover (Row & Column) in my datagrid ?

    I'm not sure what that means.
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • Flex 3 DataGrid

    Flex 3 DataGrid Control - How can i set cross rollover (Row & Column) in my datagrid ?

    Post your question in the forum for Flex.

  • Datagrid itemRenderer checkbox

    Hi,
    I have datagrid control in my application and I use itemRenderer to render some data received from webservice. Works just fine but I would like to disable changing state of checkbox. I am using checkbox renderer just to show data more user friendly and not that users can check and uncheck it. So how can I disable checking and unchecking (by user click interaction) my checkbox in datagrid?
    I my example column with dataField "IsAlive" is the one rendered by CheckBox component.
    <mx:DataGrid id="lstAllPushes" left="10" right="10" top="10" bottom="60">
    <mx:columns>
    <mx:DataGridColumn headerText="ID" dataField="ID"/>
    <mx:DataGridColumn headerText="Start date" dataField="DateInserted"/>
    <mx:DataGridColumn headerText="Expiration date" dataField="DateExpiration"/>
    <mx:DataGridColumn headerText="Alive" dataField="IsAlive" itemRenderer="mx.controls.CheckBox"/>
    </mx:columns>
    </mx:DataGrid>
    Thx in advance.

    Try this:
    <mx:DataGridColumn headerText="Alive" dataField="IsAlive" >
         <mx:itemRenderer>
              <mx:Component>
                   <mx:CheckBox enabled="false"/>
              </mx:Component>
         </mx:itemRenderer>
    </mx:DataGridColumn>

  • Suggestions to add checkbox to Report

    Version : 4.1.0
    Hi There,
    We have a classic report on an SQL. Now there is a requirement to add some sort of a check box against each report row where the user if selected, it marks that record as a favorite. That checkbox value will be stored in the table.
    If it was a tabular form, I could have just added that as a checkbox and a DB column and it would get updated when the user hit the submit button, any suggesstions on how to do this on a report? Or the only way would be to convert the report to a tabular form ? Not sure, how to capture the Radio values. Any better suggestions are also welcome.
    thanks,
    Ryan

    Hi ryansun
    you can add checkbox to your report.
    Suppose this is your query report
    SELECT empno,
           ename,
           job
    FROM   empyou want to add checkbox to your report then try the below code
    SELECT APEX_ITEM.CHECKBOX(1,empno) " ",
           ename,
           job
    FROM   emp
    Click on report attributes then edit the checkbox column
    under column attributes
    set Display as = Standard Report Column
    For detail information follow the link given below
    http://docs.oracle.com/cd/E10513_01/doc/apirefs.310/e12855/apex_item.htm#CHDDCHAF
    Hope this will solve your problem.
    Regards,
    Jitendra

  • Disable DataGrid row selection for a column?

    Hi,
    I have a DataGrid with a CheckBox in one column. When the CheckBox itself is clicked, or any point in the CheckBox column
    is clicked, I *don't* want the grid row selected. IOW, row selection should be disabled for the column. How to get this behavior?
    Thanks, Garry

    Hi All,
    I do have almost similar requirement where I have image overlay-ed on row, on whose click a context menu should appear but row should not get selected.
    Row selection should happen if user clicks elsewhere on that row (apart from overlayed image).
    I tried below lines in MouseClick event listeners.
    event.stopImmediatePropagation();
      event.stopPropagation();
    Above lines stopped itemClick event but didnt prevent the row selection.
    Regards,
    Pavan

  • Add CheckBox to JTable

    How to add a checkBox in a column of my table?
    I would like to add a checkbox in column 3. Where should I add the Listener to?

    Here's a simple example using a JCheckBox as a renderer:
    import java.awt.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import java.text.*;
    public class TableRenderer extends JFrame
        public TableRenderer()
            String[] columnNames = {"Date", "String", "Integer", "Decimal", "Boolean"};
            Object[][] data =
                {new Date(), "A", new Integer(1), new Double(5.1), new Boolean(true)},
                {new Date(), "B", new Integer(2), new Double(6.2), new Boolean(false)},
                {new Date(), "C", new Integer(3), new Double(7.3), new Boolean(true)},
                {new Date(), "D", new Integer(4), new Double(8.4), new Boolean(false)}
            DefaultTableModel model = new DefaultTableModel(data, columnNames);
            JTable table = new JTable( model )
                //  Returning the Class of each column will allow different
                //  renderers to be used based on Class
                public Class getColumnClass(int column)
                    return getValueAt(0, column).getClass();
            table.setPreferredScrollableViewportSize(table.getPreferredSize());
            JScrollPane scrollPane = new JScrollPane( table );
            getContentPane().add( scrollPane );
            //  Create cell renderer
            TableCellRenderer centerRenderer = new CenterRenderer();
            //  Use renderer on a specific column
            TableColumn column = table.getColumnModel().getColumn(3);
            column.setCellRenderer( centerRenderer );
            //  Use renderer on a specific Class
            table.setDefaultRenderer(String.class, centerRenderer);
              scrollPane.getViewport().setBackground(Color.red);
        public static void main(String[] args)
            TableRenderer frame = new TableRenderer();
            frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
            frame.pack();
            frame.setVisible(true);
        **  Center the text and highlight the focused cell
        class CenterRenderer extends DefaultTableCellRenderer
            public CenterRenderer()
                setHorizontalAlignment( CENTER );
            public Component getTableCellRendererComponent(
                JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
                super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
                if (hasFocus)
                    setBackground( Color.cyan );
                else if (isSelected)
                    setBackground( table.getSelectionBackground() );
                else
                    setBackground( table.getBackground() );
                return this;
    }For more information on "Using Tables" see the Swing tutorial:
    http://java.sun.com/docs/books/tutorial/uiswing/components/table.html

  • How to add description of a column of a table in SQL Azure

    Hi
    I have some tables in my application database where there are descriptions added against certain columns. Needless to say they were done by using sp_addextendedproperty.
    Now I am trying to migrate the Database to SQL Azure. SQL Azure does not support sp_addextendedproperty.
    Hence I am not able to figure out how to add descriptions to those columns.
    Any help would be much appreciated.
    Thanks
    Soumyadeb

    Hello,
    Just as Latheesh post above, Windows Azure SQL database are not support extended stored procedures. That’s one of the limitations on SQL database, and I don’t know there is another way to achieve the same on Azure.
    Regards,
    Fanny Liu
    Fanny Liu
    TechNet Community Support

  • SSRS 2008 R2 - Add moving average to column group

    I have a column group of dollar amounts.  The row is a year/month.  I would like to add a moving average column to the right of the last 6 months.  My SQL Server data source is already complex enough and I'd really prefer not to add a column
    there.  Is there anything I can do within the report itself?  Some way to reference the previous records in a matrix?
    Thank you!

    Hi mateoc15,
    According to your description, you have a matrix in your report. Now you want to calculate the average value of last 6 month. Right?
    In Reporting Service, we can put custom code into report to deal with complicated logic. Add one more column/row inside of group and call the functions defined in custom code. For your requirement we modified Robert’s code to achieve your goal. We tested
    your case in our local environment with sample data. Here are steps and screenshots for your reference:
    Put the custom code into report:
    Private queueLength As Integer = 6
    Private queueSum As Double = 0
    Private queueFull As Boolean = False
    Private idChange As String=""
    Dim queue As New System.Collections.Generic.Queue(Of Integer)
    Public Function CumulativeQueue(ByVal currentValue As Integer,id As String) As Object
    Dim removedValue As Double = 0
    If idChange <> id then
            ClearQueue()
                    idChange = id
                    queueSum = 0
                    queueFull = False
                    CumulativeQueue(currentValue,id)
    Else
                    If queue.Count >= queueLength Then
                                    removedValue = queue.Dequeue()
                    End If
                    queueSum += currentValue
                    queueSum -= removedValue
                    queue.Enqueue(currentValue)
                    If queue.Count < queueLength Then
                    Return Nothing
                    ElseIf queue.Count = queueLength And queueFull = False Then
                    queueFull = True
                    Return queueSum / queueLength
                    Else
                    Return (queueSum) / queueLength
                    End If
    End If
    End Function
    public function ClearQueue()
    Dim i as Integer
    Dim n as Integer = Queue.Count-1
    for i=n To 0 Step-1
                    queue.Dequeue()
    next i
    End function
    Add one more row inside of group, call the function defined in custom code.
    Save and preview. It looks like below:
    Reference:
    Moving or rolling average, how to?
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou (Pactera)

Maybe you are looking for

  • Text Import Options Menu Box

    I recently created a deck of cards in Illustrator for a design show. All the elements were created in Illustrator CS4 in different files. I started a new file and put the cards together printed and saved my file as usual. a week later I tried to open

  • Ipod no longer working.

    Hello, I've had my ipod touch for about a year, so far (2nd generation I think?) and last night I was listening to music on my ipod through itunes. Suddenly, it stopped playing and my screen was showing the apple icon (when you initially boot up). It

  • Error: Invalid Configuration Terminating the Palm Desktop

    I run Windows Vista and I have a Zire 22.  Norton was running this afternoon and telling me that I was running out of on line back up storage so I cleaned out some files and I thought I had just deleted some junk but now, when I try to launch Palm, I

  • How can others without iCloud access my calendar? there used to be a url available I could send them.

    How can others access my calendar if they don't run iClound or if they have a PC?? there used to be a url available I could send them. Now when I test to by sharing with myself on my aol account it says I have to have iCloud

  • Grey box with 'BouncingHeads' test

    Hi, PC under XP with IE 6. with Sun's JVM 1.4.2_02. Bouncing heads test only shows a grey box and http://javatester.org shows 'SunMicrosystems' only not the full version. Would could cause these not to fully work? It seems that the JVM is still half