REUSE_ALV_GRID_DISPLAY - Set cell to EDITABLE

Hi,
I am using the fn REUSE_ALV_GRID_DISPLAY. User will be entering a range of document no in the report selection. ALV grid displays the document no and other info. I could able to display a checkbox as editable next to key field - document no.
But the user wants only certain documents to have the Checkbox editable, meaning only certain documents in the ALV diplay should have the Checkbox editable and other documents in the ALV grid should have Checkbox Display only.
Can this be done programatically? I appreciate your replies?
Thanks,
Sakthi
Edited by: Sakthi Ganesan on Jan 17, 2011 9:16 PM

You should be able to get a answer by searching with in SDN (as to whether it is feasible or not).. there is even a wiki entry to do this thru  LVC functions
making some rows non-editable in ALV grid
https://wiki.sdn.sap.com/wiki/display/Snippets/DisableorEnableInputfieldsConditionallyIn+ALV

Similar Messages

  • Listbox set to NOT editable cells; EditRow property seems to override

    Hi All,
    I have several listboxes that I programmatically set to Editable Cells or not, depending on the runtime status. When I have it turned OFF, I do not want the user to be able to edit the text values in the cells.
    However, I have a RTM for the listbox with an "Edit" option. That menu item sets the EditRow property (after setting Key Focus) to the selected row. This makes the text editable, even if I have it turned OFF!!
    This is not the behaviour I expected. Is this a bug?

    Could you provide the code that you are seeing this occur in? Its almost impossible to see if this is a bug without some example. The simpler the example the better.
     It is possible that it is a bug, but it's also possible that you are setting the cell to edit mode after you set it to lock. I am wondering why you are doing that? Its most likely that you want to edit some cells but keep others locked from editing, and I do not think that is a bug, however, it might be a good product suggestion to keep certain cells permanently locked from the user, which is probably not the case with the lock function you are using (which most likely can be over ridden by other property nodes).
    Regards,
    Andrew
    National Instruments
    RIO Embedded Hardware PSE
    CompactRIO Developers Guide

  • Report Generation broken after deployment - Excel Set Cell Color and Border.vi

    Upon deployment, the Excel Set Cell Color and Border.vi became broken.  After installing LV2010 SP1 to view the VIs in the deployment, I noticed that in the second case structure where the code draws the border using the BorderAround invoke node, there is an extra variant input parameter named 'Parameters'.  Upon right-clicking, an option to 'Relink Invoke Node' appeared and after selecting this, the extra input disappeared and the VI was no longer broken.
    Why does "Relink Invoke Node" appear?  How do I create a deployment with this issue?  Has anybody else experienced this?  Why is the TestStand deployment so buggy?  

    Hi Ching-Hwa,
    I have set up a test deployment here where I am deploying a workspace that contains a sequence file.  This sequence file has a LabVIEW Action Step calling a VI that opens a new Excel file and simply calls the Excel Set Cell Color and Border VI.  After deploying this, both the VI and my test sequence ran on the deployment machine without error.  Therefore, I do have some more questions to more accurately reproduce what you are seeing.
    First, what operating systems are you developing on and deploying to?  Also, what license do you have for TestStand on the machine you are deploying to?  If you have a development version, can you manually take the sequence file and VI to this machine and run it?  I know you now have LabVIEW 2010 SP1 on your development machine, but if you have the development version of TestStand as well, it would be interesting to see if you copy the files over if you still see this behavior.  Are you including the TestStand Engine in the deployment?
    Can you open a blank VI on the deployment machine and add the Excel Set Cell Color and Border VI?  It would also be interesting to see if this is not a product of the deployment, but rather an issue with something on the deployment machine itself.  What version of the Report Generation Toolkit do you have on each machine?  Also, what versions of Excel are you using on the development and deployment machine?  Again, it would be helpful for me to know exactly what versions you have installed on both the development and deployment machines so that I can reproduce this as accurately as possible.
    One last thing to try, too, would be to try deploying the VI by itself just to see if it also has the same behavior.  Do you have the Application Builder in LabVIEW?  If so, could you also try building an executable from the VI, create an installer, and deploy this to the deployment machine?  
    In regards to the "freezing" of code by removing the block diagrams, I do not believe this will be a proper work around in this case.  While this removes the block diagram from actually being deployed along with the VI and restricts users from editing the code on the deployment machine, if something is getting changed in the compiled code upon deployment, this will not stop this from happening.  This option is available more as a memory option to lower the size of the deployment as well as prohibit any users on the development machine from editing the block diagram themselves.    
    Thanks, Ching-Hwa!  I look forward to your response so that I can continue trying to reproduce this issue.  Have a great day! 
    Taylor G.
    Product Support Engineer
    National Instruments
    www.ni.com/support

  • Setting cell color in ALV

    Hi All
    I would be greatful if someone could please help...
    I am still attempting to get cells painted within a WDA ALV grid display.
    I have tried to use the method stated in the WDA sap press book - but this method is for use with TABLE element and I am using a ViewContainerUIElement for my table. There are mentions of wonderful ways to color cells in a list display - but I cannot understand how this can be achieved. I currently have this working appart from the numeric numbers of the design being set into the relavant column cell.
    If anyone could help that would be great...
    Please see: http://picasaweb.google.co.uk/dave.alexander69/Pictures#5244800978549492338
       LOOP AT lt_zdata INTO ls_zdata.
            lv_index = sy-tabix.
    *       set column values
    *       loop at row data and set colour attributes of individual cells
            LOOP AT lt_columns ASSIGNING <fs_column>.
              lr_col_header = <fs_column>-r_column->get_header( ).
              lr_col_header->set_ddic_binding_field( ).
              CREATE OBJECT lr_input_field EXPORTING value_fieldname = <fs_column>-id.
              lr_column = lr_column_settings->get_column( <fs_column>-id ).
    *         for the date columns only...
              IF <fs_column>-id(4) = 'CELL'.
    *           get and set column dates from select option user input
                READ TABLE lt_dates INTO ls_dates INDEX 1.
                IF lt_dates IS INITIAL.
                  lr_col_header->set_text( 'Date' ).
                ELSE.
                  ls_dates-low = ls_dates-low + lv_incr_date.
                  MOVE ls_dates-low+2(2) TO lv_for_col_date+6(2).   "Year
                  MOVE ls_dates-low+4(2) TO lv_for_col_date+3(2).   "Month
                  MOVE ls_dates-low+6(2) TO lv_for_col_date(2).     "Day
                  MOVE lv_for_col_date   TO lv_col_date.
                  lr_col_header->set_text( lv_col_date ).
                  lv_incr_date = lv_incr_date + 7.
                ENDIF.
                LOOP AT lt_orgdata_dates INTO ls_orgdata_dates
                  WHERE crew = ls_zdata-crew
                    AND position = ls_zdata-position
                    AND name = ls_zdata-person
                    AND trip_arr >= ls_dates-low
                    AND trip_dep <= ls_dates-low.
    *             column heading settings
                  lr_field = lr_table->if_salv_wd_field_settings~get_field( <fs_column>-id ).
                  lr_field->if_salv_wd_sort~set_sort_allowed( abap_false ).
    * trying to set cell variants ?@#??!!???
    *              lr_cv = lr_column->set_key( ls_zdata-variance ).
    *              lr_cv->set_editor( lr_input_field ).
    *              lr_cv->set_cell_design( value = '01').
    *              lr_column->add_cell_variant( lr_cv ).
    * current method of seeting the cell colors... (but puts value in cell!)
                  FIELD-SYMBOLS: <fs> TYPE data.
                  lr_column->set_cell_design_fieldname( value = <fs_column>-id ).
                  ASSIGN COMPONENT <fs_column>-id OF STRUCTURE ls_zdata TO <fs>.
                  WRITE: CL_WD_TABLE_COLUMN=>e_cell_design-one TO <fs>.
                  MODIFY lt_zdata FROM ls_zdata. " INDEX lv_index.
                ENDLOOP.
              ENDIF.
    Kind Regards
    Dave Alexander

    Hi check this code to set cell colors for ALV grid.
    Take a context attribute with type WDUI_TABLE_CELL_DESIGN.
    Here i am populating colors based on some condition.Check the loop of the internal table.
    method get_flight_details .
    data:node_flights type ref to if_wd_context_node,
         it_flights type sflight_tab1,
         ls_flights type sflight,
         it_final type   if_componentcontroller=>elements_flights,
         ls_final type   if_componentcontroller=>element_flights.
        select * from sflight into table it_flights
    up to 100 rows.
        node_flights = wd_context->get_child_node( 'FLIGHTS' ).
        loop at it_flights into ls_flights.
           move-corresponding ls_flights to ls_final.
           if ls_final-price = '185.00'.
              ls_final-readonly = abap_true.
              ls_final-celldesign =
    cl_wd_table_column=>e_cell_design-badvalue_light.
           else.
              ls_final-readonly = ' '.
              ls_final-celldesign =
    cl_wd_table_column=>e_cell_design-goodvalue_light.
           endif.
           append ls_final to it_final.
        endloop.
        node_flights->bind_table(
            new_items            = it_final
            set_initial_elements = abap_true
    *        INDEX                = INDEX
    data: l_ref_cmp_usage type ref to if_wd_component_usage.
    l_ref_cmp_usage =   wd_this->wd_cpuse_alv( ).
    if l_ref_cmp_usage->has_active_component( ) is initial.
       l_ref_cmp_usage->create_component( ).
    endif.
    data: l_ref_interfacecontroller type ref to iwci_salv_wd_table .
    l_ref_interfacecontroller =   wd_this->wd_cpifc_alv( ).
       data:
         l_value type ref to cl_salv_wd_config_table.
       l_value = l_ref_interfacecontroller->get_model(
    * Make Price column editable
    data:l_column type ref to cl_salv_wd_column,
          l_column1 type ref to cl_salv_wd_column,
          lr_input type ref to cl_salv_wd_uie_input_field,
          l_input1 type ref to cl_salv_wd_uie_input_field.
    l_column = l_value->if_salv_wd_column_settings~get_column( 'PRICE' ).
    create object lr_input
      exporting
        value_fieldname = 'PRICE'
    l_column->set_cell_editor( value = lr_input ).
    * to make some cells non editable
    lr_input->set_read_only_fieldname( value = 'READONLY' ).
    l_value->if_salv_wd_column_settings~delete_column( id = 'READONLY'   )
    *Set the table Editable
    l_value->if_salv_wd_table_settings~set_read_only( value = abap_false ).
    *Give colors to cells
    l_column1 = l_value->if_salv_wd_column_settings~get_column( 'CARRID' ).
    l_column1->set_cell_design_fieldname( value = 'CELLDESIGN'  ).
    l_value->if_salv_wd_column_settings~delete_column( id = 'CELLDESIGN' )
    endmethod.
    Thanks
    Suman

  • Is it possible that a particular row of IWDTable set to non editable?

    Hi All,
    Is it possible that a particular row of IWDTable set to non editable on the basis of a field value ?? Plz help.

    Context
    + Rows (node)
       + value (integer)
       + readOnly (boolean,calculated=true)
    Bind the "readOnly" property of the InputField (cell editor) to the "readOnly" attribute shown above. Implement the calculated attribute getter like
    boolean getRowsReadOnly(IRowsElement element)
      return element.getValue() == 42; /* or whatever */
    Armin

  • Protect the cell from editing (MS Project)

    is it possible to protect the cell from editing (Gantt Chart view)? 
    I try to do it through the event Application_ProjectBeforeTaskChange and setting Cancel to true 
    which method is called when the edit cell and press the ESC?

    Hi,
    Thanks for posting in MSDN forum.
    This forum is for developers discussing issues about
    apps for Office. Since the issue is more relative to Project developing, I would like to move it to
    Project Customization and Programming forum to get more effective response.
    Thanks for your understanding.
    Best regards
    Fei
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Set Cell or Row to read only if certain condition is met

    Greetings,
    As the subject suggest, I need to set Cells or Rows to Read Only or "Gray out" If Certain attribute doesnt contain any value.
    The requirement is to search for records of certain range and display it in the table. And the records will not be editable (read only) if certain attribute/field of the record is NULL. In another words that particular row will be gray-ed out.
    Right now I am able to extract out the range of records out and display it in the table but I am not able to set the display of the records/ rows to read only. Do note only certain row needs to be set to row only depending on a particular attribute.
    I was to code these in WDDOMODIFYVIEW()... anyone have any solution to this? Points will be given of course. ")

    Please dont use the DOMODIFY method for such changes.
    The Properties mapped to the context are designed for exactly this purpose.
    Your context node should be extended with another attribute. Eg attr_y_Read_only.
    The read_only or enabled attribute of field y would then be mapped to this attribute.
    Depending on cell editor type it may be called enabled or read only.
    You then set this new attribute to true or false appropriately for each element in the node.
    This new attribute, although inside the node, need not be displayed as part of the table.
    It is there to help control fields in the each element.
    Regards
    Phil.

  • Must double click JTable cell to edit - Why?

    Hi there,
    I have a custom JTable model, which overrides the isCellEditable method and returns true for the first column. All nice, only that column now gets editable - but why do I have to double click in the cell to be able to edit in it? I've seen swing gui's where the cell gets editable on single click/focus...
    Very thankful for any help in resolving this!
    Best regard,
    AC

    Add a mouselistener to your table and in the mousePressed() method set the editing cell:
    table.editCellAt(row, column);
    table.setEditingRow(row);
    table.setEditingColumn(column);
    table.repaint();

  • JTable cell being edited after model changed.

    I have a fairly simple JTable, with a implementation of AbstractTableModel supplying the data. The cells are edited by using a JComboBox. I wrap these into a DefaultCellEditor. I have a KeyListener attached to the JTable listening for VK_DELETE, and when it finds one, instructs the model to delete the row represented by the selected row in the table.
    Everything works fine until I want to delete a row from the table. My scenario is:
    - I click in a cell, and the editor opens.
    - I select an entry in the list. The editor closes, the result is rendered, and the wee yellow box around the cell is shown
    - I hit the delete key.
    - My key listener picks up the event, and informs the model to delete the row. I remove the row from the model and invoke fireTableDataChanged().
    The result is that the row is deleted, but the table ends up with the cell editor deployed on the cell of the row below (which is now at the same row as the one I just deleted).
    My tracing shows that the isCellEditable is called on the model after the delete. I don't know why.
    Can anyone explain how to prevent this or what might be causing the table to think that the cell needs editing?
    Thanks, Andrew

    It will do whatever is the default. I wrap the JComboBox in a DefaultCellEditor. I can't see how the editor is involved at this point, or why the editor becomes involved after the row has been deleted.
    Remember, at the time that I hit the delete key, there is no editor rendered or visible. I have the JTable displayed, a row selected, and the yellow box around one of the (editable but not currently being edited) cells. This has been achieved by editing a cell (displaying the cell editor - a combo box) and selecting an entry. The editor is removed, and the cell displayed with the (default) cell renderer for the table.
    The delete action is caught by the listener on the table, the model is instructed to delete a row from its underlying data, which fires a fireTableDataChanged event.
    That is all I do. After that it is all swing. The table model starts getting asked about cells being editable after I have finished deleting the row. I'll post the relevant code below if that helps.
    The datamodel is of class ConstraintTableModel (see below) and the column model is of class DefaultTableColumnModel
    JTable table = new JTable( dataModel, columnModel );The column model is defined liike so:
    columnModel = new DefaultTableColumnModel();
    TableColumn labelColumn = new TableColumn(ConstraintTableModel.LABEL_COLUMN);
    labelColumn.setHeaderValue( dataModel.getColumnName(ConstraintTableModel.LABEL_COLUMN));
    labelColumn.setPreferredWidth( 5 );
    labelColumn.setMaxWidth( 5 );
    labelColumn.setResizable( false );
    TableColumn taskColumn = new TableColumn(ConstraintTableModel.TASK_COLUMN);
    taskColumn.setHeaderValue( dataModel.getColumnName(ConstraintTableModel.TASK_COLUMN));
    TableColumn typeColumn = new TableColumn(ConstraintTableModel.TYPE_COLUMN);
    typeColumn.setHeaderValue( dataModel.getColumnName(ConstraintTableModel.TYPE_COLUMN));
    columnModel.addColumn( labelColumn );
    columnModel.addColumn( taskColumn );
    columnModel.addColumn( typeColumn );I add the key listener like so:
    table.addKeyListener( new KeyAdapter()
        public void keyPressed( KeyEvent e )
          if( e.getKeyCode() == KeyEvent.VK_DELETE )
            log.debug("Delete pressed in listener attached to table ");
            JTable t = (JTable) e.getSource();
            int selectedRow = t.getSelectedRow();
            if( selectedRow >= 0 )
              log.debug("  Removing row " + selectedRow);
              ((ConstraintTableModel)t.getModel()).removeRow(selectedRow);
            log.debug("Finished with key press");
      } );The cell editor is created like this:
    JComboBox taskEditorComponent = new JComboBox( tasksModel );
    taskEditorComponent.setFont( GanttChart.tableFont );
    taskEditorComponent.setBackground( Color.WHITE );
    DefaultCellEditor taskEditor = new DefaultCellEditor(taskEditorComponent);
    taskEditor.setClickCountToStart( 1 );
    table.setDefaultEditor( GanttTask.class, taskEditor );The model is coded like so:
    class ConstraintTableModel extends AbstractTableModel
        // Constants
        public static final int LABEL_COLUMN = 0;
        public static final int TASK_COLUMN = 1;
        public static final int TYPE_COLUMN = 2;
        private Vector          columnNames;
        private ArrayList       dataRows;
        public ConstraintTableModel()
            super();
            this.buildDataVector();
            this.addPrimerRow();
         * Every row in the table is a GanttConstraint. Therefore when deciding what to
         * display in any particular column of the table, we need to determine what the
         * column is, and then use the informatino in the GanttConstraint to go out to the
         * lookup and get the relevant object, and value to display.
        public Object getValueAt( int row, int col )
            Object          returnObject = "";
            GanttConstraint aConstraint = (GanttConstraint) this.getDataRows().get( row );
            // We're rendering the task column. If there's no task id (partially filled in row)
            // return blank otherwise return the master task
            else if( col == ConstraintTableModel.TASK_COLUMN )
                if( aConstraint.getMasterId() != null )
                    GanttTask masterTask = (GanttTask) real.getLookup().get( aConstraint.getMasterId() );
                    returnObject = masterTask;
            // We're rendering the type column. If there's no type (partially filled in row)
            // return blank otherwise return the constraint type
            else if( col == ConstraintTableModel.TYPE_COLUMN )
                if( aConstraint.getType() != null )
                    GanttConstraintType constraintType = (GanttConstraintType) GanttConstraintType.getConstraintTypes()
                                                                                                     .get( aConstraint.getType()
                                                                                                                      .intValue() );
                    returnObject = constraintType;
            return returnObject;
         * When we receive this message, we are handed an object of the type specified in
         * getColumnClass. We need to take this object and place the relevant information into
         * the GanttConstraint row in the table model.
         * Depending on whether the row being modified is an existing row or a new row, set
         * the state of the constraint appropriately.
         * @see javax.swing.table.TableModel#setValueAt(java.lang.Object, int, int)
        public void setValueAt( Object value, int row, int col )
            log.debug( "+setValueAt (row/col) " + row + "/" + col );
            if ( value == null )
                log.debug( "  handed a null value. Returning" );
                return;
            GanttConstraint aConstraint = (GanttConstraint) this.getDataRows().get( row );
            // If we are modifying the primer row, add another primer row.
            if( row == ( this.getRowCount() - 1 ) ) // Last row is always the primer
                log.debug( "  adding a primer row" );
                this.addPrimerRow();
            // We're modifying the Task data. Get the GanttTask handed to us and place it
            // into the master slot in the constraint.
            if( col == ConstraintTableModel.TASK_COLUMN ) // Task
                log.debug( "  updating the master task" );
                GanttTask selectedTask = (GanttTask) value;
                aConstraint.setMaster( selectedTask );
            // We're modifying the Type data. Get the GanttConstraintType handed to us and place it
            // into the type slot in the constraint.
            if( col == ConstraintTableModel.TYPE_COLUMN ) // Constraint type
                log.debug( "  updating the constraint type" );
                GanttConstraintType selectedConstraintType = (GanttConstraintType) value;
                aConstraint.setType( selectedConstraintType.getType() );
            log.debug( "-setValueAt" );
        public Class getColumnClass( int col )
            Class columnClass = super.getColumnClass( col );
            if( col == ConstraintTableModel.LABEL_COLUMN )
                columnClass = String.class;
            if( col == ConstraintTableModel.TASK_COLUMN )
                columnClass = GanttTask.class;
            if( col == ConstraintTableModel.TYPE_COLUMN )
                columnClass = GanttConstraintType.class;
            return columnClass;
        // We are handing the data storage
        public void setDataRows( ArrayList dataRows )
            this.dataRows = dataRows;
        public boolean isCellEditable( int row, int col )
            log.debug( "+isCellEditable (row/col) " + row + "/" + col );
            if( !real.canEdit() )
                return false;
            if( ( col == ConstraintTableModel.TASK_COLUMN ) ||
                    ( col == ConstraintTableModel.TYPE_COLUMN ) )
                return true;
            else
                return false;
        // We are handing the data storage
        public ArrayList getDataRows()
            return this.dataRows;
        public String getColumnName( int column )
            return (String) this.getColumnNames().get( column );
         * Clean up rows that do not have both the master task and type set. Not interested in them
        public void removeDirtyRows()
            log.debug( "+removeDirtyRows" );
            Iterator dataIterator = this.getDataRows().iterator();
            while( dataIterator.hasNext() )
                GanttConstraint element = (GanttConstraint) dataIterator.next();
                if( ( element.getMasterId() == null ) || ( element.getType() == null ) )
                    element.setTransient();
                    dataIterator.remove();
            fireTableDataChanged();
            log.debug( "-removeDirtyRows" );
        public void removeRow( int row )
            log.debug( "+removeRow(" + row + ")" );
            if( row < this.getDataRows().size() )
                GanttConstraint aConstraint = (GanttConstraint) this.getDataRows().get( row );
                this.getDataRows().remove( row );
                if( aConstraint.isClone() )
                    aConstraint.setDeleted();
                else
                    aConstraint.setTransient();
                    getClone().removeConstraint( aConstraint );
                fireTableDataChanged();
            if( this.getRowCount() == 0 )
                this.addPrimerRow();
            log.debug( "-removeRow" );
        public void clearRow( int row )
            log.debug( "+clearRow(" + row + ")" );
            if( row < this.getDataRows().size() )
                GanttConstraint aConstraint = (GanttConstraint) this.getDataRows().get( row );
                aConstraint.setMasterId( null );
                aConstraint.setType( null );
                fireTableRowsUpdated( row, row );
            log.debug( "-clearRow" );
        public int getColumnCount()
            return getColumnNames().size();
        public int getRowCount()
            return dataRows.size();
         * The table will be filled with constraints relevant to 'clone'.
        private void buildDataVector()
            ArrayList  data = new ArrayList( 1 );
            Collection allConstraints = getClone().getStartConstraints();
            allConstraints.addAll( getClone().getEndConstraints() );
            Iterator constraintIter = allConstraints.iterator();
            while( constraintIter.hasNext() )
                GanttConstraint element = (GanttConstraint) constraintIter.next();
                if( element.getType().equals( GanttConstraint.START_SPECIFIED ) ||
                        element.getType().equals( GanttConstraint.FINISH_FROM_DURATION ) )
                    continue;
                else
                    data.add( element );
            this.setDataRows( data );
        private Vector getColumnNames()
            if( columnNames == null )
                columnNames = new Vector( 3 );
                columnNames.add( " " ); // Needs space otherwise all the headers disappear
                columnNames.add( "Task" );
                columnNames.add( "Constraint" );
            return columnNames;
        private void addPrimerRow()
            log.debug( "+addPrimerRow" );
            // Create a constraint for the 'clone' task. Set it as transient until validation
            // where we will deal with it if necessary.
            GanttConstraint primer = new GanttConstraint( real.getLookup() );
            primer.setObjectId( chart.getNextUniqueId() );
            primer.setTransient();
            primer.setSlave( getClone() );
            primer.setProject( getClone().getProject() );
            getClone().addConstraint( primer );
            this.getDataRows().add( primer );
            int lastRow = this.getRowCount() - 1;
            fireTableRowsInserted( lastRow, lastRow );
            log.debug( "-addPrimerRow" );

  • JTable cannot make cell non-editable

    I have create a JTable using the DefaultTablemodel. I want to make the cells non editable. I have overwritten the method isCellEditable with that shown below but when I double click any cell it still let me edit the cell. Someone please show me what is wrong.
    public boolean isCellEditable(int cellrow, int cellcol)
    return(false);
    // if (cellcol == 0)
    // return(false);
    // else
    // return(true);
    Regards
    pslloo

    Look at the tutorial! This sample works.
    Hope this help.
    import javax.swing.JTable;
    import javax.swing.table.AbstractTableModel;
    import javax.swing.JScrollPane;
    import javax.swing.JFrame;
    import javax.swing.SwingUtilities;
    import javax.swing.JOptionPane;
    import java.awt.*;
    import java.awt.event.*;
    public class TableDemo extends JFrame {
        private boolean DEBUG = true;
        public TableDemo() {
            super("TableDemo");
            MyTableModel myModel = new MyTableModel();
            JTable table = new JTable(myModel);
            table.setPreferredScrollableViewportSize(new Dimension(500, 70));
            //Create the scroll pane and add the table to it.
            JScrollPane scrollPane = new JScrollPane(table);
            //Add the scroll pane to this window.
            getContentPane().add(scrollPane, BorderLayout.CENTER);
            addWindowListener(new WindowAdapter() {
                public void windowClosing(WindowEvent e) {
                    System.exit(0);
        class MyTableModel extends AbstractTableModel {
            final String[] columnNames = {"First Name",
                                          "Last Name",
                                          "Sport",
                                          "# of Years",
                                          "Vegetarian",
                                          "essai"};
            final Object[][] data = {
                {"Mary", "Campione",
                 "Snowboarding", new Integer(5), new Boolean(false), new Integer(3)},
                {"Alison", "Huml",
                 "Rowing", new Integer(3), new Boolean(true), new Integer(3)},
                {"Kathy", "Walrath",
                 "Chasing toddlers", new Integer(2), new Boolean(false), new Integer(3)},
                {"Sharon", "Zakhour",
                 "Speed reading", new Integer(20), new Boolean(true), new Integer(3)},
                {"Angela", "Lih",
                 "Teaching high school", new Integer(4), new Boolean(false), new Integer(3)}
            public int getColumnCount() {
                return columnNames.length;
            public int getRowCount() {
                return data.length;
            public String getColumnName(int col) {
                return columnNames[col];
            public Object getValueAt(int row, int col) {
                return data[row][col];
             * JTable uses this method to determine the default renderer/
             * editor for each cell.  If we didn't implement this method,
             * then the last column would contain text ("true"/"false"),
             * rather than a check box.
            public Class getColumnClass(int c) {
                return getValueAt(0, c).getClass();
             * Don't need to implement this method unless your table's
             * editable.
            public boolean isCellEditable(int row, int col) {
                //Note that the data/cell address is constant,
                //no matter where the cell appears onscreen.
                if (col < 2) {
                    return false;
                } else {
                    return true;
             * Don't need to implement this method unless your table's
             * data can change.
            public void setValueAt(Object value, int row, int col) {
                if (DEBUG) {
                    System.out.println("Setting value at " + row + "," + col
                                       + " to " + value
                                       + " (an instance of "
                                       + value.getClass() + ")");
                if (data[0][col] instanceof Integer                       
                        && !(value instanceof Integer)) {                 
                    //With JFC/Swing 1.1 and JDK 1.2, we need to create   
                    //an Integer from the value; otherwise, the column    
                    //switches to contain Strings.  Starting with v 1.3,  
                    //the table automatically converts value to an Integer,
                    //so you only need the code in the 'else' part of this
                    //'if' block.                                         
                    //XXX: See TableEditDemo.java for a better solution!!!
                    try {
                        data[row][col] = new Integer(value.toString());
                        fireTableCellUpdated(row, col);
                    } catch (NumberFormatException e) {
                        JOptionPane.showMessageDialog(TableDemo.this,
                            "The \"" + getColumnName(col)
                            + "\" column accepts only integer values.");
                } else {
                    data[row][col] = value;
                    fireTableCellUpdated(row, col);
                if (DEBUG) {
                    System.out.println("New value of data:");
                    printDebugData();
            private void printDebugData() {
                int numRows = getRowCount();
                int numCols = getColumnCount();
                for (int i=0; i < numRows; i++) {
                    System.out.print("    row " + i + ":");
                    for (int j=0; j < numCols; j++) {
                        System.out.print("  " + data[i][j]);
                    System.out.println();
                System.out.println("--------------------------");
        public static void main(String[] args) {
            TableDemo frame = new TableDemo();
            frame.pack();
            frame.setVisible(true);
    [\code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Need help with Report Generation Toolkit: Excel Set Cell Format.vi

    Hi people,
    I've been searching and found this old thread of someone asking what is the input parameter "Number format". And I dont know what should I put in there. I've tried so many possibilities, but nothing works so far, such as:
    0,0
    0,?
    0,#
    #,0
    ?,0
    and also with @, doesnt works. Where would I find help about this parameter?
    I'm using Excel2003, german version, thus local decimal separator is a comma.
    I also found this help from NI, but seems doesnt help me either. Do I miss something important?
    thanks,
    Yan. 

    Hi,
    I've used your suggestion and some numbers in excel doesnt need to get "right click, change to numbers" anymore (green indicators on the left-top side in some cells are gone). But, I think its still not a number, because I cant use a simple formula, such as in cell A10 I type "= A1/2" (cell A10 equals cell A1 divided with 2) . I got error which says its not a number.
    Well, but other thing is found, any format-string I put in the input of Excel Set Cell Format.vi, such as #,########, will be shown the same as "customize #,########" if I right click in a cell in excel and click "Zellen formatieren" (formatting cell). But however, the numbers are still depends on the input of the format I put in the Append Table to Report.vi.
    regards,
    Yan.

  • Sharing stopped.  Sharing set to allow editing and viewing.  He can see what I enter.  I can't see his entries.

    Sharing set to allow editing and viewing.  He can see what I enter.  I can't see his entries. He sees his entries plus mine.  I only see mine.  This all worked fine a week ago.

    I'm sorry to be so incredibly dense. The article to which you linked says:
    "If the computer is already authorized, the item plays. If the computer has not yet been authorized, iTunes asks you to enter the Apple ID and password you used to purchase the song."
    I can play songs from my husband's library. I can't drag them into my library.
    If deauthorizing/authorizing is the solution, who needs to do what? We've got three computers and two iTunes accounts.

  • JTable how to set cell ediatble false

    - Can teach me JTable how to set cell ediatble false?
    - And I'm not so understand about following method and sentence...
    addRowSelectionInterval(int index0, int index1)
    Adds the rows from index0 to index1, inclusive, to the current selection.
    - Then what is toggle? What is the usage? How to use?
    - Then how to add one more row in the Jtable?

    - Can teach me JTable how to set cell ediatble false?check the method isCellEditable()
    Use DefaultTableModel
    - And I'm not so understand about following method and sentence...
    addRowSelectionInterval(int index0, int index1)
    Adds the rows from index0 to index1, inclusive, to the current selection.
    - Then what is toggle? What is the usage? How to use?
    - Then how to add one more row in the Jtable?[JTable API|http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JTable.html]

  • Excel Set Cell Color and Border.viのbackground color 設定について

    お世話になっております。
    Microsoft オフィス用レポート生成ツールキットを使って
    LabVIEWで収集したデータをExcelファイルで出力しようと考えています。
    そこで質問が有ります。
    題名のようにExcel Set Cell Color and Border.viのbackground color 設定についてです。
    デフォルト(未配線)では白に設定されていますが、”色なし”に設定するにはどうしたら良いのでしょうか?
    又、罫線色等を指定する数値設定に関しては、何処を調べたら良いのでしょうか?
    ご教授の程、宜しくお願い致します。

    _YN 様
    平素よりNI製品をご利用頂きまして誠にありがとうございます。
    日本ナショナルインスツルメンツ技術部の湧川と申します。
    ご質問にお答え致します。
    色なしにしたいとの事ですが、こちらでExcel Set Cell Color and Border.viを使用して簡単なVIを実行させてみましたが色なしに設定することはできませんでした。
    そこで質問したいのですが色なしにする理由というのはバックグラウンドが白のままだとセルの枠が見えなくなるからでしょうか。
    もしそうであれば設定により枠をつけることができますのでそちらの方を試して頂けたらと思います。
    方法としましては同じExcel Set Cell Color and Border.viを使い設定します。
    アイコンの上部にピンク色のピンが2つあるかと思いますがそちらからセル内側の線、外側の線を設定できます。
    添付した画像を参照して下さい。
    画像のように設定しますとセルに黒色の枠ができると思います。
    数値設定などに関しても質問されていますが、そちらはヘルプがありますのでそちらを参照頂けると詳しい情報がわかるかと思います。
    LabVIEWでVIを開いている時に ctrl + H を押しますと小さいウィンドウ「詳細ヘルプ」が立ち上がります、その状態でマウスのポインタをアイコンに重ねて頂きますと詳細ヘルプにアイコンの説明が記述されます。
    ウィンドウズ内のリンクからオンラインヘルプを参照することもできます。
    上記内容をご確認いただきまして、何かS_YN様の意図と違う点などありましたらご連絡下さい。
    宜しくお願い致します。
    日本ナショナルインスツルメンツ株式会社
    技術部
    湧川 朝満
    添付:
    Excle Set Color Sample.JPG ‏58 KB

  • How to disable/enable the cells for editing column wise in JTable in java?

    Hi All,
    Can any one tell me how to disable the cells for editing by column wise in JTable?
    Here depending upon the radio button selected, I need 2 disable some columns for editing
    and enable some columns for editing?
    how can I do tat using JAVA?
    Any sample code is of great help to me.
    Thanks in Advance

    http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
    ~

Maybe you are looking for

  • How do you install CC on a second Mac?

    It tells you to deactivate CC if you want to install on a THIRD Mac, but doesn't tell you what to do to install on a SECOND Mac. I've had plenty of hassle upgrading to a new Mac in general, and I don't want to risk losing my first installation by dea

  • Very strange error : IDOC to jdbc scenario

    Hi I am getting a very strange error when I see the log for the idoc to jdbc scenario that I am building. The mapping test shows the header record and line item record properly in the mapping result. insert, access nodes, fields with access nodes are

  • How can I delete iMessages app off my macbook?

    I do not want my text messages and all to come on my macbook. How can I remove this app off my macbook pro?

  • Unbold Numbered List

    How do I unbold the numbered list? The first phrase is bolded in my list but I do not want the numbers to be bold. Thanks!

  • WeighBride Integration with SAP

    Hi Experts, We have a scenario to integrate WeighBride with SAP.In WeighBridge using Avery-Digitizer and MS-sql for weighing vehicle weight. Once the vehicle entering into WB the weight reading get in to the VB application automatically. we need to c