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);
};
Similar Messages
-
HOW TO MAKE TABLE CONTROL NON EDITABLE
hi all
how to make table control non editable
Thanks & Regards
harshaHi,
Try this code in the PBO inside the module in the LOOP...ENDLOOP.
IF SY-TCODE EQ 'ZEMPLDISPLAY'.
LOOP AT SCREEN.
if screen-name eq 'column1' or screen-name eq 'column2'. "Give the names of the columns in the table control
SCREEN-INPUT = '0'.
MODIFY SCREEN.
endif.
ENDLOOP.
ENDIF.
Or you can go the Layout of the table control in Change mode and for every column's attributes, make it 'Output' only field. Check 'Output only' field. -
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. -
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 -
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 NarulaHi 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 -
How to make some fields of table as non editable through SM30
Hi,
I craeted a custom table and maintained thriugh sm30. 2 fields should be read only. Can any one help me un that
Regards,
JayaramCreate a view and in the maintain status ,make it read only so that the fields will be on read only mode .
Girish -
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"/>
-
One row as editable and other row as non-editable in table control
Hi Experts,
Is this possible to make one row as editable and another row is non editable in table control?
My Requirement is
1st row non editable field
Customer code, description,amount will come from the previous screen this will be non editable for user.
2nd row editable
User has to enter the amount in 2nd row here the customer code description will be empty.
If 4 customer are there
1,3,5,7 should be non editable and 2,4,6,8 should be editable..
Pls help me in this issue..
Thanks in Advance!hI
This is a simple Module POOL program with only Table control and nothing else
" This is Tested to Enable one row and disabling the next row
in TOP Include
controls : tc type tableview using screen 100.
DATA : OK TYPE SY-UCOMM.
DATA : ITAB TYPE TABLE OF SPFLI WITH HEADER LINE.
in PBO
PROCESS BEFORE OUTPUT.
MODULE status_0100.
LOOP AT itab WITH CONTROL tc.
MODULE TC_MOD.
ENDLOOP.
in PAI
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
LOOP AT itab.
ENDLOOP.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'TEST'.
SET TITLEBAR 'TEST'.
DESCRIBE TABLE itab LINES tc-lines.
IF tc-lines = 0.
tc-lines = 20.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
MODULE tc_mod OUTPUT.
DATA : mod TYPE i.
LOOP AT SCREEN.
mod = tc-CURRENT_LINE MOD 2 .
IF mod = 1.
IF screen-name = 'SPFLI-CARRID'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDIF.
ENDLOOP.
ENDMODULE. " TC_MOD OUTPUT
Edited by: Ramchander Krishnamraju on Jan 25, 2011 7:17 AM -
Hi experts,
I need make my table control as noneditable for a specific transaction after fetching values.
i did till fetching part and displaying in table control. but its diplaying as editable field. i need to make that as non editable... plz help me in this....this screen is for only dispaly purpose...
Note:- i did Table control through wizard...Based on your transaction identifier , and also give the Screen group1 for all the columns ex: AAA you can do some thing like this in the PBO
PBO
Loop at itab with control tc.
module input_enable_disable.
endloop.
module input_enable_disable output.
if Transaction = 'DISP'.
loop at screen.
if screen-group = 'AAA'.
screen-input = 0.
modify screen.
endif.
endloop.
endif.
endmodule. -
Table control : Need to change Single field as non editable
Hi Experts,
Plz help me out. In a table control there r 7 fields and only one field is editable. When i change the status of a record as delete in tat table control, only the deleted record (all fields)should become non-editable. Is it possible? Pls suggest.
Regards,
J. Sriram.Hi,
In PBO of your screen
you should be using a step loop like this :
CONTROLS control1 TYPE TABLEVIEW USING SCREEN 100.
LOOP AT itab WITH CONTROL control1.
ENDLOOP.
Where the control1 is the tableview control defined in your program
and placed on your screen.
Put a second loop on screen inside this loop ant set the related attribute :
LOOP AT itab WITH CONTROL control1.
LOOP AT SCREEN.
IF SCREEN-NAME = 'COLUMN1'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDLOOP.
So you can set cells editable or non-editable
and you can filter it which record & which field.. -
Adding an editable row in an non editable table.
Hi,
My requirement is to add an Editable row in a table which is in display mode only, i mean i cannot edit the data that is present in the table.
But if the user presses the Add Row button on the Table Toolbar, a new editable row should be added in the end, so that he can save the new data entered.
methods tried:
1: I have used Inputfield as Cell Editors, with their Read only Property check marked, thougt that with the new element created, it would not be Read Only.
2: Binded the read only property with a context attribute, but still was not able to achieve this functionality.
3: Tried the above two steps with the "Enabled" property of the Table Coloumn Cell Editors as well, but no result.
Please give me some pointers on this.
Regards,
AshishHi Ashish,
The approach you were following was correct, but I am not sure where you have placed the Enabled property attribute in the context.
Please follow these steps:
1. The table you are creating should have the enabled property set.
2. The context with you are binding the table should have an additional attribute say ISENABLED of type boolean.
3. Bind this attribute with the ENABLED property of all the input enabled fields in your table.
4. When binding the non-editable data into the table, set this property to ABAP_FALSE for each record. This will make the existing data non editable.
5. Use the below code for adding a new row and set the ISENABLE property of the added row to ABAP_TRUE.
elem_table = node_table->create_element( ).
node_table->bind_element( new_item = elem_table set_initial_elements = abap_false ).
stru_table-isenable = abap_true .
elem_new_row->set_static_attributes( static_attributes = stru_table ).
Let me know how you go about it.
Cheers,
Pratibha -
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
ManishManish,
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 -
In WD application making one WD-table field un-editable.
Hi,
I have changed one WD application and I have added one table(Layout data: Matrix head data),
in which I made one column as editable"Bind to property of the selected attribute-Enabled". My requirement
is to make for one particular row - make that column non-editable.
Please let me know if anyone come across this kind of requirement?
I wrote a code in method for the element(table): WDDOMODIFYVIEW
* lo_el_nd_partner = lo_nd_nd_partner->get_element( index = sy-tabix ).
* lo_el_nd_partner->set_attribute_property(
* attribute_name = 'GPARN'
* property = 3 "Property 3 for read-only
* value = 'X'). "Disable vendor number editing for VN row
But still it is editable.
Best regards,
Anilkumar.Hi Anil,
As you are having a context attribute ZGPARN_READONLY to make the columne GPARN as read only based on the value inside the table.
You just need to bind the READONLY property of GPARN to context attribute ZGPARN_READONLY as below
Now, if you pass value X to attribute, then the particular cell will be made as read only
"Read table data from context node into lt_nd_parnter.
loop at lt_nd_partner assigning <ls_partner> where parvw = 'VN'.
<ls_partner>-ZGPARN_READONLY = abap_true.
endloop.
" bind the table to context node
lo_node->bind_table( new_items = lt_nd_partner ).
Hope this helps you.
Regards,
Rama -
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 AMHi 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 -
Making table cells non-focusable
I have a JTable in which some of the cells should never receive the keyboard focus. I want the TAB key to skip over these non-editable cells, but I'm having trouble. I've tried using a cell renderer where getTableCellRendererComponent calls setFocusable(false). This has no effect at all. How can I get the focus to skip forward to the next editable cell when I press the TAB key?
some of the cells should never receive the keyboard focus
I want the TAB key to skip over these non-editable cellsThese a two separate and different requirements. Using the Tab key does not prevent the user from clicking on the cell. But if this is the real requirement then check out this posting for one solution:
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=657819 -
Table Maintenance Generator : Editable Entry after validation fails
Hi,
I have created a Z table and a table maintenance generator to maintain the data.
I have to carry out certain validations when user enters data on Key and Non- key fields.
This is working fine, but the issue is with the key fields.
If validation fails, the table maintenance screen is displayed the date-field is grayed out (non-editable) as it is the key field of the table.
Now the user cannot change the data unlike the non-key fields were the user can modify the non-valid data and save again.
How can make the date field (Key Field) editable after entry in case the validation fail, so that the user can make the changes.
Please suggest the approach to handle the above scenario in events.
Thanks,
KeyurThanks Kiran for your inputs.
I have done the same thing what you have explained.
I have used a Form Routine as CIP_SAVE with Event Number as 01, since on event SAVE i need to validate whether dates are
overlapping the inputs dates or not.
Fields are :
Group ID (Key)
Start Date (Key)
End Date (Key)
Value (Non -Key)
Initial value in Table:
Group ID = 12345
Start Date = 01/01/2011
End Date = 01/31/2011
Value = 11.11
Now if i try to enter value:
Group ID = 12345
Start Date = 01/02/2011
End Date = 01/25/2011
Value = 99.99
& SAVE it... validation will fails because Start & End dates overlaps.
Hence, on Table Maintainance Screen all key fields will be in non-editable display mode, whereas non-key field will be in editable mode.
My requirement is that Start Date & End Date key fields must be Editable field.
Thanks.
Maybe you are looking for
-
Where is the fix already? Logic Pro from the APP store won't install!
Who do you contact concerning an app store purchase that seems to be causing problems throughout the community with zero response from Apple as to the solution? I just bought Logic Pro (long time Logic Express user). It won't Install PERIOD - It is s
-
Move rejected to trash doesn't work
I used space saver to reject videos that were not in the project or labeled with a keyword, and they are clearly marked as rejected. But when I click on "move to trash", nothing happens. I really need the space on my computer. Is there any way to cle
-
Why am I unable to connect to free Wi-Fi in public places?
How come I am not able to use my iTouch wi-fi in places that offer free wi-fi? All I get is a little pop-up box that tells me that it cannot initialize wi-fi. I can use the wi-fi feature with my airport on my home computer, but that's it. I am a litt
-
Copy all fields from pdf to word
copy all fields from pdf to word
-
Bailout: failed spill-split-recycle sanity check
hi all i hope someone can help me! we have an enterprise portals productive installation on aix5.3 it is based on netweaver 7.0 i have just installed a java dialog instance on a windows 2003 server 64 bit which is happily talking to the central insta