Making a particular Column Non Editable

Hi all,
My question is that ... i ahve created a jtable in default table model ........
And i have maked a column as a row header .. by using table column model..And the problem is that the column which has been made as a rowheader is in editable mode .. i want to make it non editable .. it is possible or not
here is my code
TableColumnModel Tc1 = new DefaultTableColumnModel() {
                boolean first = true;
                public void addColumn(TableColumn tc) {
                  // Drop the first column . . . that'll be the row header
                  if (first) { first = false; return; }
                  tc.setMinWidth(110);
                 super.addColumn(tc);
          TableColumnModel rowHeader = new DefaultTableColumnModel() {
                boolean first = true;
                public void addColumn(TableColumn tc) {
                  if (first) {
                    tc.setMaxWidth(36);
                    super.addColumn(tc);
                    first = false;
          model1= new DefaultTableModel(100,10);
          tb=new JTable(model1,Tc1);
          tb.setRowHeight(20);
          tb.createDefaultColumnsFromModel();
          tb.setPreferredScrollableViewportSize(new Dimension(770,350));
          JTable headerColumn1 = new JTable(model1, rowHeader);
          headerColumn1.createDefaultColumnsFromModel();
           headerColumn1.setCellSelectionEnabled(false);
          headerColumn1.setRowHeight(20);
          headerColumn1.setBackground((Color)UIManager.get("TableHeader.background"));
          tb.setSelectionModel(headerColumn1.getSelectionModel());
          tb.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
         headerColumn1.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
         headerColumn1.setSelectionBackground(Color.lightGray);
         headerColumn1.setColumnSelectionAllowed(false);
         JViewport jv1 = new JViewport();
         jv1.setView(headerColumn1);
         jv1.setPreferredSize(headerColumn1.getMaximumSize());
          jsp = new JScrollPane(tb);
          jsp.setRowHeader(jv1);

override isCellEditable(int row, int column) as:
public boolean isCellEditable(int row, int column){
      return ( column != nonEditableColumnIndex ? true : false);
}cheers
DB

Similar Messages

  • Custom ItemRenderer makes the column non editable

    Hi Folks,
    I have a DataGrid which s editable, I've created a custom ItemRenderer to deal with special format needed for Date variables, for that I extended the mx:Text class in order to get access to the listData.dataField variable.
    The problem is that this makes the column non-editable, the other column in the table are editabe.
    When I used a VBox container the column was editable however I didn't get access to the listData, which I need for the dataField variable.
    Any help will be appreciated.
    Thanks,
    MR.
    Here is the my DateItemRenderer code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Text xmlns:fx="http://ns.adobe.com/mxml/2009"
                                    xmlns:s="library://ns.adobe.com/flex/spark"
                                    xmlns:mx="library://ns.adobe.com/flex/mx">
         <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
         </fx:Declarations>
         <fx:Script>
              <![CDATA[
                   import aslib.common.Constants;
                   import aslib.common.Utils;
                   import aslib.connection.JSONConnector;
                   import mx.controls.dataGridClasses.DataGridListData;
                   import mx.controls.listClasses.ListData;
                   import mx.formatters.DateFormatter;
                   [Bindable]
                   private var _dispValue:String;               
                   public function dateStr(val:Object):String {
                        var innerDt:Date;
                        if(!(val is Date))
                             innerDt = Utils.convertDateStr(val as String);
                        else
                             innerDt = val as Date;
                        if(innerDt){
                             var df:DateFormatter = new DateFormatter();
                             df.formatString = "DD/MM/YYYY";
                             var formatedDate:String = df.format(innerDt);                                                       
                             return formatedDate;
                        }else{
                             return "";
                   public override function set data(value:Object):void {
                        var date:Object = value[(listData as DataGridListData).dataField];
                        if(date){
                             _dispValue = dateStr(date);
              ]]>
         </fx:Script>
         <mx:text>{_dispValue}</mx:text>
    </mx:Text>

    OK, found the issue, forgot to add 'super.data = value' in the set data method...

  • How do I make the particular column to editable one in the multicolumn list box?

    Hi,
    I am updating different parameters in the multicolumn list box.I am having four columns.
    I want to make 3 columns non editable to user and 4th column is editable one.
    How do i do this?
    Help me
    Regards
    Meenatchi

    Meenatchi wrote:
    I want to make 3 columns non editable to user and 4th column is editable one.
    Your question title & the message you ve posted are contradictory to each other.
    Normally a Multicolumn Listbox is a non-editable one, in that while you run you wont get the labeling tool to type some text.
    I think you can instead use a Table to achieve your purpose. Also see the below link.
    http://forums.ni.com/ni/board/message?board.id=170&message.id=131631#M131631
    Or, the attached VI, modified from that post, of course.
    - Partha
    LabVIEW - Wires that catch bugs!
    Attachments:
    Make some columns of a Table only as Editable.vi ‏32 KB

  • SOLAR01 / 02 Administration tab - making 'Plan Data' fields non-editable

    For the SOLAR01 / 02 t-codes, and under the Administration tab, how can one make the 'Plan Data' non-editable for the users. This is required so that the planned data is controlled only by the Admin / Mgmt team and the functional and technical team can update only the 'Actual Data' fields.
    Thanks very much,
    Varun Narula

    Hi Prakhar,
    I would like to create a project plan similar to MS Project with tasks, activities etc. and having planned and actual dates. The ASAP roadmap structure is more suitable for this kind of thing, but it does not provide a tab to add the planned and actual dates.
    The SOLAR01 provides the Admin tab for the planned and actual dates, but it has a constraint that the structure it creates is only 2 levels deep. Besides, I don't want the Org Structure, Master Data and Business Processes sub-folders to appear under each task / activity.
    Any ideas if any of the above can be achieved?
    Regards,
    Varun

  • Making a Table/Table Non-editable

    I have a table made by a DefaultTableModel which then produces a JTable. I have set a listener on to the JTable to recognise when a row is selected. What I also want to do is make it so the user can not type new information into the table. It doesn't actually store anything in the background but I want all the data to stay the same visually as it does when it first appears.

    try this
    JTable table = new JTable() {
          public boolean isCellEditable(int rowIndex, int vColIndex) {
          if (vColIndex == 0) { // What ever the col index is
             return (false);
          else {
             return (true);
       };

  • How to set a column in JTable non-editable?

    I have a JTable, and how can I set a particular column non-editable?
    Thank you.

    You could create a sub class of DefaultTableModel, you pass the column number to the constructor or you add a method like setColumnEditable(0, false); to set column 0 non-editable.
    You overwrite the method isCellEditable so it will return false when the column number that is passed to the method is 0 (if you want to have column 0 non-editable).

  • How to design ALV GRID with a column in NON-editable Mode and has F4 Help?

    Hello Friends,
      How to code for ALV GRID, which has a column that takes value only from F4 Help and does not accept any other user input?
    Can I have that column non-editable and yet has F4 Help?
    Please help ASAP.

    Hi,
      The examples in the mentioned programs do not suffice my problem.In these programs. They have made the cell non-editable but you cant even input value through F4 Help.
    I want to make a cell non-editable (which can be changed only through F4 Help), which do not accept user input.

  • Make a Timecard line non editable

    Hi,
    We have a self service timecard entry system. When a user creates a new timecard his regular hours are autopopulated from his rotation plan (Work Schedule template). He can enter the overtime worked on additional rows. Is there a way we can stop the user from modifying the regular hours which are auto populated by making that specific row non editable? Or any other solution for this requirement?
    Thanks

    <s:TextArea editable="false"/>

  • Making particular rows as non editable before displaying the TABLE

    Hi everyone,
                               I would like to know how to make a particular rows as non editable in UI element "TABLE" before it is displayed . The scenario is :
    On entering the Personnel number, I am getting family dependants in the table. Then, I am selecting any of the family members on some condition and saving each member with the request.
    Next time when i enter the same personnel number, I would like to show the table with already saved request for the family members rows as non editable & other members row as editable.????
    Please provide a feasible solution.

    Hi Pradeep,
    follow as per suggested. if not work use cell variants concept. it will work.
    Please check this wiki...
    http://wiki.sdn.sap.com/wiki/display/WDABAP/WebDynproforABAPCellVariants
    Cheers,
    Kris.

  • Make Non-editable Column in Table Control of ME21N and ME22N

    Hi Experts,
    I was trying to look for a solution to make the columns for field MEPO1320-SLFDT(Stat Deliv. Date), MEPO1320-EEIND (Deliv. Date) and MEPO1211-NETPR (Net Price) from transaction ME21N and ME22N to be non-editable ONLY when Qty Received (MEPO1320-WEMNG) > 0.
    I'd found that the modify screen codes were located at Class CL_TABLE_VIEW_MM, Method MODIFY_SCREEN_TC_LINE but there were no enhancement spots available to add my code. Is there any other method i can use to make those fields non-editable?
    Thanks in advance!
    Cheers,
    Cheng
    Edited by: Cheng Mei Tan on Jun 4, 2009 9:31 AM

    Hi Cheng,
    I think you can use this BAdi: ME_PROCESS_PO_CUST - Enhance Processing of Enjoy Purchase Order.
    Use the method PROCESS_ITEM to control the fields at the item level.
    I think is not possible to make the fields non-editable, however, you can put an error message whenever your condition is verified, and the user won't be able to change the fields.
    Cheers,
    Pedro

  • How to set a particular column editable in adf?

    Hi,
    I have a table which has 3 columns. While inserting new row, two column values are auto populated. One column should be editable. But in my case I am not able to edit the third column. How to make only the third column editable? I am using 11.1.2.2.0 version of JDeveloper
    Regards,
    Infy

    I have created view object based on the entity object. I have verified, the undatable check box is checked. Let me modify my question. I have master-child tables. I am implementing CRUD functionality in both the tables. Its done & working fine. When I insert new record in child table, two columns are auto populated, and the third column should be editable. If I don't auto populate, the third column is editable, but if I auto populate, third column is becoming non editable. How to achieve this?

  • How to make a particular row and column field editable in ALV

    Hi Experts,
    I have a requirement to make a particular row and column field editable in ALV output. Like i need to make 2nd row - 4th column editable of ALV output.
    Kindly help me out to solve this.
    Any help would be appreciated.
    Thanks,
    Ashutosh

    Hi Ashutosh,
    please check below, explained by some experts.
    In the below link  editing two columns MOD_RANK and TECH_RANK.
    These two columns will be in edit mode once after selecting the required record
    Editing single cell in a row of ALV table
    And also look for more info
    http://scn.sap.com/thread/884976

  • How to make a table column block editable for a row and remain non editable for other row based on some condition

    hi ,
    i need help on the below scenario ,
    we have a web dynpro table with different columns, now based on new business requirement  one of the column need to     
    dynamically editable or non editable for different row.
    for ex :
    Field 1
    Field 2 ( Dynamic field )
    Field 3
    Field 4
    Data 11
    Data 12 ( Editable with Drop down   )
    data 13
    data 14
    Data 21
    Data 22 ( Non editable )
    Data 23
    data 24
    Data 31
    data  32 ( Editable with drop down )
    data 33
    data 34
    how to achieve this ? please help on this.
    Thanks in advance
    Thanks
    Manish

    Manish,
    there is no proper way to insert two Cell Editors in a column(except variants), have a look on below scenario, it may help.
    add one more attribute to your table context node for read-only.
    create dropDown as celleditor for table and bind with newly created attribute to read-only property of dropdown.
    before binding data to table, check the condition then mention readonly value abap_true / false.
    @ we can achieve by the use of Variants.
    for ex :
    Data 11
    Data 12 ( Editable with Drop down)
    data 13
    read-only - abap_false
    Data 21
    Data 22 ( Non editable, dropdown )
    Data 23
    read-only - abap_true
    Data 31
    data  32 ( Editable with drop down )
    data 33
    read-only - abap_false

  • 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

  • How to make a row non-editable depending on a db column value

    HI,
    I've an editable report region and the requirement is to make the row non-editable according to the value in one of the column. Like if the value for that column is null the row should be editable else non-editable. Any option to do this in Oracle APEX.
    Regards,
    Prasanth

    I assume you are using a tabular form. In that case, you would have to run a loop in Javascript to read all the rows in the Form. The example is given below. You can use Firebug in Firefox to identify your field names and replace f02, f03 and f04 with your field names.
    <script language="JavaScript" type="text/javascript">
    function f_readonly_items(){
    for (i=0;i<document.wwv_flow.length;i++)
    if (document.wwv_flow.f02.value) != Null
    document.wwv_flow.f02[i].readOnly = true;
    document.wwv_flow.f03[i].readOnly = true;
    document.wwv_flow.f04[i].readOnly = true;
    </script>
    Hope this helps.

Maybe you are looking for

  • Is there any bapi for LECI tcode

    i would like to make data transformation to LECI tcode by usign bapi . i need the bapi name for this work

  • Cost center field make display in AM

    Hi all, I want to make cost center filed display(gray)  in asset master record. my requirement is no one can change the cost center in the master data. How will i do that. please guide me Thanks in Advance Deepti reddy Edited by: Deepti reddy on May

  • Labview and Visual C++ 6.0

    Howdy, I need to send data from a Visual C++ application to Labview over a tcp/ip network. How do I do it? Are there any examples to study out there? Thanks, M Soderberg Sent via Deja.com http://www.deja.com/ Share what you know. Learn what you don't

  • Can I use attunity CDC to propagate changes from sql server to a sybase database

    can i use attunity cdc components in sql server to propagate changes to a sybase destination. I did some experimenting with cdc in ssis 2012 and got it working to send changes to sybase, but I need to do this for approx 5000 tables. so looking for a

  • Real simple question Fusion BigBang MB P55 1156 601-7582-010

    I am planning on purchasing a compatible video card for this MB, but until then.  Can I use my NVIDIA GeForce 7950 GT with it? Thanks in advance. Bryan