Make the jtable column editable
Hi,
I want to make the table column editable,that like double click on an editable table cell,and edit it directly.
How to solve it?
hi!
if you want to make any particular column editable you may have to do something like this
TableModel dataModel = new AbstractTableModel() {
public int getColumnCount() { return names.length; }
public int getRowCount() { return data.length;}
public Object getValueAt(int row, int col) {return data[row][col];}
public String getColumnName(int column) {return names[column];}
public Class getColumnClass(int c) {return getValueAt(0, c).getClass();}
public boolean isCellEditable(int row, int col) {return col != 5;}
public void setValueAt(Object aValue, int row, int column) { data[row][column] = aValue; }
}; the isCellEditable(row, col) is importantin your case.
i hope it may help you
:)
Similar Messages
-
How to make the text_field to editable in the adobe document?
Hi, expert,
I meet a problem when I develop a WDA. I hope to get your help. Thanks a lot. The following is my action:
Action:
1. I am using "Text Field" control rather "Text" Control in the pfd form by transfer code "sfp". I make sure in Object Palette under value tab type is : user entered - optional in the layout tab in the pfd form. The textfield is editable in the PDF preview.
2. Add the pdf forms to webdynpro application and set "sss" to the inputfield("Text Field") through context in the WDA.
3. Run the WDA. In the IE, I found the textfield in the PDF is not editable. How can I make the textfield to editable?
Whether I need change the code or others to make text_field to editable?
Do you give me some hints? Thank you very much.
The following is my code in the WDA:
method WDDOMODIFYVIEW .
********Make INTERACTIVE_FORM to editable。******
data:
lr_interactive_form type ref to cl_wd_interactive_form,
lr_method_handler type ref to if_wd_iactive_form_method_hndl.
lr_interactive_form ?= view->get_element( 'INTERACTIVE_FORM' ).
lr_method_handler ?= lr_interactive_form->_method_handler.
lr_method_handler->set_legacy_editing_enabled( abap_true ).
data:
Node_Zz_00_Test_Form_000 type ref to If_Wd_Context_Node,
Elem_Zz_00_Test_Form_000 type ref to If_Wd_Context_Element,
Stru_Zz_00_Test_Form_000 type Wd_This->Element_Zz_00_Test_Form_000 ,
Item_TEST1 like Stru_Zz_00_Test_Form_000-TEST1.
navigate from <CONTEXT> to <ZZ_00_TEST_FORM_000> via lead selection
Node_Zz_00_Test_Form_000 = wd_Context->get_Child_Node( Name = wd_This->wdctx_Zz_00_Test_Form_000 ).
get element via lead selection
Elem_Zz_00_Test_Form_000 = Node_Zz_00_Test_Form_000->get_Element( ).
get single attribute
Elem_Zz_00_Test_Form_000->set_Attribute(
exporting
Name = `TEST1`
Value = 'sss' ).
endmethod.
Best regards,
taoHi Volker,
Thanks a lot for your help.:)
When I compile the WDA, the WDA don't occur any error. The WDA occurs error when I run the WDA.
1. In the st22 transcation code, I found the following code:
method RAISE .
DATA: error TYPE STRING.
error = MSG_STRING( msg = msg a = a b = b c = c i = i j = j k = k ).
************************begin of error************************************
RAISE EXCEPTION TYPE CX_WD_GENERAL EXPORTING msg = error.
************************end of error*********************************
endmethod.
I think the method RAISE is invoked by CREATE_ADOBE method at the point:
if sy-subrc ne 0.
--- there was an error; check, if it was an ADS related problem
call function 'FP_GET_LAST_ADS_ERRSTR'
importing
e_adserrstr = lv_adserrstr.
cx_wd_general=>raise( msg = lv_adserrstr ).
endif.
--- close spool job
The following is the code of the CREATE_PDF method:
method CREATE_PDF.
data:
data_source_info type ref to if_wd_context_node_info,
data_source_attributes type wdr_context_attr_info_map,
interface_type type fpinterfacetype,
name type string,
value type string,
fm_name type rs38l_fnam,
fp_docparams type sfpdocparams,
fp_outputparams type sfpoutputparams,
fp_output type fpformoutput,
pdf_ref type ref to fpformoutput,
output type fpformoutput,
rest type string,
lv_adserrstr type string. "#EC NEEDED
field-symbols:
<source> type wdr_context_attribute_info.
data_source_info = data_source->get_node_info( ).
data_source_attributes = data_source_info->get_attributes( ).
--- now build pdf content using the form api
try.
--- get name and type of the generated function module
call function 'FP_FUNCTION_MODULE_NAME'
exporting
i_name = form_name
importing
e_funcname = fm_name
e_interface_type = interface_type.
----- what about error handling
catch cx_fp_api_usage. "#EC NO_HANDLER
catch cx_fp_api_repository. "#EC NO_HANDLER
catch cx_fp_api_internal. "#EC NO_HANDLER
endtry.
--- set output parameters and open spool job
fp_outputparams-nodialog = 'X'.
fp_outputparams-getpdf = 'X'.
--- workaround ADS drop 8c
fp_outputparams-connection = 'ADS_PWDF2036'.
call function 'FP_JOB_OPEN'
changing
ie_outputparams = fp_outputparams.
--- set form language and country (->form locale)
fp_docparams-langu = sy-langu.
call function 'WP_USER_COUNTRY_GET'
exporting
user_name = sy-uname
importing
country = fp_docparams-country
exceptions
no_country_assigned = 1
others = 2.
if sy-subrc <> 0.
fp_docparams-country = 'DE'.
endif.
--- this flag indicates that we want to generate an interactive(!) form
fp_docparams-fillable = enabled.
--- interface type: SMART FORMS => raise error
--- interface type: DDIC => use DDIC interface and render display only form
--- interface type: XML Schema => use XML interface and render interactive form if enabled is true
case interface_type.
Smart Forms -> not allowed
when if_fp_interface=>c_interface_type_sf.
message x000(00).
Good old DDIC
when if_fp_interface=>c_interface_type_new.
no interactivity for DDIC stuff allowed, but it can be overwritten
if enabled = abap_true.
fp_docparams-fillable = legacy_editing_enabled.
else.
fp_docparams-fillable = abap_false.
endif.
data:
exception_list type table of rsexc,
export_parameters type table of rsexp,
import_parameters type table of rsimp,
tables_parameters type table of rstbl.
--- get the interface of the generated function module
call function 'FUNCTION_IMPORT_INTERFACE'
exporting
funcname = fm_name
tables
exception_list = exception_list
export_parameter = export_parameters
import_parameter = import_parameters
changing_parameter =
tables_parameter = tables_parameters.
data:
ptab type abap_func_parmbind_tab,
ptab_line type abap_func_parmbind,
etab type abap_func_excpbind_tab,
etab_line type abap_func_excpbind.
field-symbols:
<import> type rsimp.
--- dynamical filling of the interface of the generated function module
loop at import_parameters assigning <import>.
ptab_line-name = <import>-parameter.
ptab_line-kind = abap_func_exporting.
if ptab_line-name cs '/1bcdwb/docparams'.
get reference of fp_docparams into ptab_line-value.
else.
--- is this an attribute?
data dref type ref to data.
create data dref type (<import>-typ).
read table data_source_attributes with key name = <import>-parameter assigning <source>.
if sy-subrc = 0.
data: node_name type string.
node_name = <import>-parameter.
try.
field-symbols <statatt> type any.
assign dref->* to <statatt>.
data_source->get_attribute( exporting name = node_name importing value = <statatt> ).
get reference of <statatt> into ptab_line-value.
catch cx_root. "#EC CATCH_ALL
ptab_line-value = dref.
endtry.
else.
ptab_line-value = dref.
endif.
endif.
insert ptab_line into table ptab.
endloop.
ptab_line-name = '/1BCDWB/FORMOUTPUT'.
ptab_line-kind = abap_func_importing.
get reference of fp_output into ptab_line-value.
insert ptab_line into table ptab.
--- error handling
etab_line-name = 'OTHERS'.
etab_line-value = 10.
insert etab_line into table etab.
--- dynamic call of the generated function module
--- this is "smart forms style"
call function fm_name
parameter-table
ptab
exception-table
etab.
if sy-subrc ne 0.
--- there was an error; check, if it was an ADS related problem
call function 'FP_GET_LAST_ADS_ERRSTR'
importing
e_adserrstr = lv_adserrstr.
cx_wd_general=>raise( msg = lv_adserrstr ).
endif.
--- close spool job
call function 'FP_JOB_CLOSE'.
--- check the result
read table ptab with key name = '/1BCDWB/FORMOUTPUT' into ptab_line.
pdf_ref ?= ptab_line-value.
pdf = pdf_ref->pdf.
XML Schema based interface
when if_fp_interface=>c_interface_type_xsd.
data: xml type string.
xml = data_source->to_xml( ).
data:
context_node type string.
context_node = data_source_info->get_name( ).
data: x_xml type xstring.
if not data_xml is supplied.
call transformation wdr_interactive_from_in
parameters datasource = context_node
source xml xml
result xml x_xml.
else.
x_xml = data_xml.
endif.
call function fm_name
exporting
/1bcdwb/docparams = fp_docparams
/1bcdwb/docxml = x_xml
importing
/1bcdwb/formoutput = output
exceptions
usage_error = 1
system_error = 2
internal_error = 3
others = 4.
if sy-subrc ne 0.
--- there was an error; check, if it was an ADS related problem
call function 'FP_GET_LAST_ADS_ERRSTR'
importing
e_adserrstr = lv_adserrstr.
cx_wd_general=>raise( msg = lv_adserrstr ).
endif.
--- close spool job
call function 'FP_JOB_CLOSE'.
pdf = output-pdf.
when others.
message x000(00).
endcase.
endmethod.
2. I found the defaultTrace.0.trc in the $sap_home$\DEV\DVEBMGS00\j2ee\cluster\server0\log\:
#1.5#001485BBC8ED0076000000140000044000043973130FA533#1189066310671#com.adobe.AdobeDocumentServicesWorker#com.adobe/AdobeDocumentServices#com.adobe.AdobeDocumentServicesWorker#ADSUSER#228#SAP J2EE Engine JTA Transaction : [018ffffff826002ffffffcc]#devserver_DEV_1606150#Guest#d1f02e705c5011dcb0f5001485bbc8ed#SAPEngine_Application_Thread[impl:3]_22##0#0#Error#1#/System/Server#Plain###Processing exception during a "UsageRights" operation.
Request start time: Thu Sep 06 16:11:50 CST 2007
com.adobe.ProcessingError: Error while retrieving a password for credential: ReaderRights:
java.lang.Exception: Could not retrieve a password for credential: ReaderRights
Exception Stack Trace:
com.adobe.ProcessingError: Error while retrieving a password for credential: ReaderRights:
java.lang.Exception: Could not retrieve a password for credential: ReaderRights
at com.adobe.ads.request.UsageRights.execute(Unknown Source)
at com.adobe.BaseADSRequest.doWork(Unknown Source)
at com.adobe.AdobeDocumentServicesWorker.execute(Unknown Source)
at com.adobe.AdobeDocumentServicesEJB.processRequest(Unknown Source)
at com.adobe.AdobeDocumentServicesEJB.rpData(Unknown Source)
at com.adobe.AdobeDocumentServicesLocalLocalObjectImpl0.rpData(AdobeDocumentServicesLocalLocalObjectImpl0.java:120)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sap.engine.services.webservices.runtime.EJBImplementationContainer.invokeMethod(EJBImplementationContainer.java:126)
at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:157)
at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:79)
at com.sap.engine.services.webservices.runtime.servlet.ServletDispatcherImpl.doPost(ServletDispatcherImpl.java:92)
at SoapServlet.doPost(SoapServlet.java:51)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
#1.5#001485BBC8ED0076000000150000044000043973130FAAAC#1189066310671#com.adobe.AdobeDocumentServices#com.adobe/AdobeDocumentServices#com.adobe.AdobeDocumentServices#ADSUSER#228#SAP J2EE Engine JTA Transaction : [018ffffff826002ffffffcc]#devserver_DEV_1606150#Guest#d1f02e705c5011dcb0f5001485bbc8ed#SAPEngine_Application_Thread[impl:3]_22##0#0#Error##Plain###Client: 800 SystemId: DEV AppName: SAFP
Processing exception during a "UsageRights" operation.
Request start time: Thu Sep 06 16:11:50 CST 2007
com.adobe.ProcessingError: Error while retrieving a password for credential: ReaderRights:
java.lang.Exception: Could not retrieve a password for credential: ReaderRights
at com.adobe.ads.request.UsageRights.execute(Unknown Source)
at com.adobe.BaseADSRequest.doWork(Unknown Source)
at com.adobe.AdobeDocumentServicesWorker.execute(Unknown Source)
at com.adobe.AdobeDocumentServicesEJB.processRequest(Unknown Source)
at com.adobe.AdobeDocumentServicesEJB.rpData(Unknown Source)
at com.adobe.AdobeDocumentServicesLocalLocalObjectImpl0.rpData(AdobeDocumentServicesLocalLocalObjectImpl0.java:120)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sap.engine.services.webservices.runtime.EJBImplementationContainer.invokeMethod(EJBImplementationContainer.java:126)
at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:157)
at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:79)
at com.sap.engine.services.webservices.runtime.servlet.ServletDispatcherImpl.doPost(ServletDispatcherImpl.java:92)
at SoapServlet.doPost(SoapServlet.java:51)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
According the exception in the defaultTrace.0.trc:" Could not retrieve a password for credential: ReaderRights ", beacause Adobe reader8 don't get the credential in my machine, the error is occured when run the WDA.
My question is how can I to get credential for Adobe Reader8 ?
Thanks a billion for your support and help.:-)
Best regards,
Tao -
Windows 8 how do you make the bookmarks column "flexible"?
Is the problem with the Bookmarks Sidebar -- the one you can open and close by pressing Ctrl+b? It does seem to have a minimum width and won't get narrower than that, but I'm not sure whether you are running into that limitation or whether for some reason you are not getting the resizing arrow when you mouse over the thin border between the sidebar and the page.
-
How to make the vendor column have figure in GRIR line item with RE document type?
Dear Experts,
Could you tell me how to make the vendor column have figure in GRIR line item whose document type is RE?
Thanks!
Xinling ZhangHi ,
You are using FAGLL03 .
FAGLL03 report vendor code is blank
vendor number in new FAGLL03 tcode (offsetting account information)
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/30b96fed-eb5d-2e10-1792-f3ff9f65df8a?QuickLink=index&…
Also check OSS note
Note 112312 - Line item: Display of offsetting a/c information
Note 1034354 - FAGLL03: Display of offsetting account information
Many Thanks -
How to create a dynamic table were the JTable columns keep varying
How to create a dynamic table were the JTable columns keep varying based on the input to the jtable
Oooh, I lied. DefaultTableModel has an API for adding and
removing columns. I didn't know that. You should have read
the API.
As for preferring to extend AbstractTableModel rather than
DefaultTableModel, I think it's more correct. DefaultTableModel
is a simple implementation of Abstract for basic cases. It isn't
intended to be extended. I figure most people extending
DefaultTableModel are also extending JFrame, JPanel, and Thread
instead of encapsulating the first two and implementing
Runnable for the third. -
Our WPF application uses DataGrid.
One of request is that first column of DataGrid does not show row separator and also does not show Left column separator. So it looks like the first column does not belong to the DataGrid. However, when select a row, the cell of first column still get selected.
How do we make it? Thx!
JaneCHi Magnus,
Thanks for replying our question and provide your solution!
Your solution works by setting "HorizontalGridLinesBrush" and "VerticalGridLinesBrush" to {x:Null} in the DataGrid style and modify "CellStyle" in first column as following:
<DataGridTextColumn MinWidth="32"
Binding="{Binding CellName}"
CanUserReorder="False"
CanUserSort="False"
Header="Cell}"
IsReadOnly="true" >
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="IsEnabled" Value="False"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Border BorderThickness="0" BorderBrush="{x:Null}"
Background="{Binding Background, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" Margin="-1">
<Grid Background="{TemplateBinding Background}" VerticalAlignment="Center" Height="42">
<ContentPresenter VerticalAlignment="Center"/>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
We found another way to achieve it by using DataGridRowHeader. The good way to use DataGridRowHeader is that we do not need to make the first column ReadOnly (click on first column does not select whole row anymore). Select RowHeader in a row will select
whole row. Move scroll bar horizontally, the row header still keep in visible area.
<Style TargetType="{x:Type DataGridRowHeader}" x:Key="dataGridRowHeaderStyle">
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="Height" Value="42" />
<Setter Property="SeparatorBrush" Value="{x:Null}" />
<Setter Property="FontSize" Value="16" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridRowHeader}">
<Grid>
<Border x:Name="rowHeaderBorder"
BorderThickness="0"
Padding="3,0,3,0"
Background="{Binding Background, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"
BorderBrush="{x:Null}">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<DataGrid>
<DataGrid.RowHeaderStyle>
<Style TargetType="DataGridRowHeader" BasedOn="{StaticResource dataGridRowHeaderStyle}">
<Setter Property="Content" Value="{Binding CellName}" />
<Setter Property="Width" Value="35"/>
</Style>
</DataGrid.RowHeaderStyle>
</<DataGrid>
JaneC -
How to edit the JTable columns
Hi all,
please help me on this..
I created one Jtable with 0-9 columns(10 columns)and
I put only the 9th(last column) column is editable.
the problem is if I enter any text message in 9th column
and press another column then immediatly dissapears the
9th column text...
please tell me how to solve this problem .. because I want to take the
9th column text to another Object....
please send the solution anyone knows..
public boolean isCellEditable(int row, int col){
if(col == 9){
return true;
}else{
return false;
}If things go wrong while trying to edit table cells there is a good chance that you hit one of the many well known or even a new bug. These bugs are highly version dependent. So in any question please include the jdk version you are using and a very exact description of what you are seeing.
Here I assume that by "press another column" you mean "click the mouse in the header region"?
If so that's one of the well known, long-standing and not yet solved problems: jTable does cancel any edit on any notification from the columnModel - and due to suboptimal implementation of the tableHeaderUI even a single click does fire such a notification.
There is some debate about how to handle the situation but no easy or totally satisfying approach - your best bet is to search the bug parade (and google) for partial solutions and their pros and cons.
Greetings
Jeanette -
How to make a entire column editable in an ALV grid
Hi all,
I am trying to make a column editable in an ALV grid. For that I wrote the following code. In the below code I have set the 'edit' field of ls_fcat to 'X'. But Iam getting Runtime error. Can anyone help in resolving this problem or suggest any method to make a column editable in an ALV grid.
form prepare_fc changing go_fieldcat type lvc_t_fcat.
data: ls_fcat type lvc_s_fcat.
refresh: go_fieldcat.
clear: ls_fcat.
ls_fcat-reptext = ' Safety Stock Figures'.
ls_fcat-coltext = 'Safety Stock Figures'.
ls_fcat-fieldname = 'EISBE'.
ls_fcat-ref_table = 'IMAT'.
ls_fcat-edit = 'X'.
modify go_fieldcat from ls_fcat.
APPEND LS_FCAT TO GO_FIELDCAT.
endform.
Thanks & Regards,
Vishnu Priya.ls_fcat-edit = 'X'.
is correct only.
have a look into this code
struct_grid_lset TYPE lvc_s_layo,
i_grid_fcat TYPE lvc_t_fcat
DATA ls_fcat TYPE lvc_s_fcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'MONTH'.
ls_fcat-ref_table = 'TYPE'.
ls_fcat-ref_field = 'C'.
<b> ls_fcat-edit = 'X'.</b>
ls_fcat-coltext = text-030."Month
ls_fcat-seltext = text-030.
APPEND ls_fcat TO p_i_grid_fcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'YEAR'.
ls_fcat-ref_table = 'TYPE'.
ls_fcat-ref_field = 'C'.
ls_fcat-coltext = text-031."Year
ls_fcat-seltext = text-031.
APPEND ls_fcat TO p_i_grid_fcat.
CALL METHOD o_grid->set_table_for_first_display
EXPORTING
i_bypassing_buffer = space
is_variant = ws_f_grid_disvar
i_save = ws_c_grid_save
is_layout = struct_grid_lset
CHANGING
it_outtab = i_grid_outs[]
<b>it_fieldcatalog = i_grid_fcat[]</b>
it_sort = i_sort_fcat. " Period
Also Check this code.Another way using field symbols.
i_fieldcat TYPE lvc_t_fcat,
w_layout TYPE lvc_s_layo ,
w_variant TYPE disvariant.
FIELD-SYMBOLS : <lfs_fieldcat> TYPE lvc_s_fcat.
*Default display
LOOP AT p_fieldcat ASSIGNING <lfs_fieldcat>.
CASE <lfs_fieldcat>-fieldname.
WHEN 'GL_ACCT'.
<lfs_fieldcat>-coltext = text-050.
<lfs_fieldcat>-no_out = ' '.
<lfs_fieldcat>-scrtext_l = text-050.
<b> <lfs_fieldcat>-edit = 'X'.</b>
WHEN OTHERS.
ENDCASE.
ENDLOOP.
Hope this helps. -
WPF: how to make the grid column edtiable base on cell content?
our WPF application uses DataGrid.
One grid column we need base on cell has value or not to decide if make the cell editable.
If cell is empty, not editable. If cell is not empty, make it editable.
The cell is bind to a class. We try to make property to bind to the
DataGridTextColumn
IsReadOnly property
public bool IsSampleIdFieldReadOnly { get { return string.IsNullOrEmpty(_sampleId); } }
DataGridTextColumn MinWidth="120"
Binding="{Binding SampleId}"
IsReadOnly="{Binding IsSampleIdFieldReadOnly}"
Header="Sample ID" />
However all cells in the column are editable.
how to achieve that? Thx!
JaneCI guess that will apply to the whole column rather than specific cells and you need a cellstyle.
You could try something like:
<DataGridTextColumn Binding="{Binding SampleId}" Header="Sample Id">
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Style.Triggers>
<DataTrigger Binding="{Binding IsSampleIdFieldReadOnly}" Value="true">
<Setter Property="IsReadOnly" Value="true" />
</DataTrigger>
</Style.Triggers>
I'm afraid I don't have enough time to test it as I'm off out drinking shortly.
Hope that helps.
Recent Technet articles:
Property List Editing ;
Dynamic XAML -
How to make the text_field to editable in a adobe document in the WDA?
Hi, expert,
I meet a problem when I develop a WDA. I hope to get your help. Thanks a lot. The following is my action:
Action:
1. Make a pdf forms (interactive form) with textfield named A_textfield in the webdynpro application. The textfield is editable in the PDF preview when I creat the pdf form using transfer code 'sfp'.
2. Add the pdf forms to webdynpro application and set "sss" to the inputfield through context in the WDA.
3. Run the WDA. In the IE, I found the PDF document with the text_field, but the textfield in the PDF is not editable.
How can I change the code or others to make text_field to editable?
Do you give me some hints? Thank you very much.
The following is my code in the WDA:
method WDDOMODIFYVIEW .
********Make INTERACTIVE_FORM to editable。******
data:
lr_interactive_form type ref to cl_wd_interactive_form,
lr_method_handler type ref to if_wd_iactive_form_method_hndl.
lr_interactive_form ?= view->get_element( 'INTERACTIVE_FORM' ).
lr_method_handler ?= lr_interactive_form->_method_handler.
lr_method_handler->set_legacy_editing_enabled( abap_true ).
data:
Node_Zz_00_Test_Form_000 type ref to If_Wd_Context_Node,
Elem_Zz_00_Test_Form_000 type ref to If_Wd_Context_Element,
Stru_Zz_00_Test_Form_000 type Wd_This->Element_Zz_00_Test_Form_000 ,
Item_TEST1 like Stru_Zz_00_Test_Form_000-TEST1.
navigate from <CONTEXT> to <ZZ_00_TEST_FORM_000> via lead selection
Node_Zz_00_Test_Form_000 = wd_Context->get_Child_Node( Name = wd_This->wdctx_Zz_00_Test_Form_000 ).
get element via lead selection
Elem_Zz_00_Test_Form_000 = Node_Zz_00_Test_Form_000->get_Element( ).
get single attribute
Elem_Zz_00_Test_Form_000->set_Attribute(
exporting
Name = `TEST1`
Value = 'sss' ).
endmethod.
Best regards,
taoHello Wang,
Just for confirmation: The interactiveform ui element is enabled, right? By default, it's disabled.
Best regards,
Thomas -
How to make the combobox column in grid can be selectable
Hi,
I have a grid in a form and use a SQL query as the data source. Now I want to make a column(a field in a SQL query) to be displayed as combobox and user can select it. I tried to use below code to make the column displayed like a combobox, it seems that the colunn becomes a dropdown box but i can't select it. Also I can't find a way to add valid value and description into this combobox like what I do on a combobox in a form.
oGrid.Columns.Item("Approved").Type = SAPbouiCOM.BoGridColumnType.gct_ComboBox;
SAPbouiCOM.GridColumn col = oGrid.Columns.Item("Approved");
then ???
Any suggestion?
Thanks!
LanHi Lan
Try This For Matrix......
'For Adding Values
oColumn = oColumns.Add("Drink", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX)
oColumn.TitleObject.Caption = "Drink"
oColumn.Width = 100
'Add Valid Values
oColumn.ValidValues.Add("Cola", "")
oColumn.ValidValues.Add("7up", "")
oColumn.ValidValues.Add("Fanta", "")
oColumn.ValidValues.Add("Orange Juice", "")
oColumn.ValidValues.Add("Water", "")
oColumn.ValidValues.Add("Lemonade", "")
oColumn.ValidValues.Add("Ice Tea", "")
oColumn.ValidValues.Add("Coffee", "")
'For selected Value
Dim ocombo As SAPbouiCOM.ComboBox
Dim oform As SAPbouiCOM.Form
Dim omat As SAPbouiCOM.Matrix
oform = SBO_Application.Forms.Item("MOR1")
omat = oform.Items.Item("mat").Specific
ocombo = omat.Columns.Item("Drink").Cells.Item(1).Specific
ocombo.Select("Fanta", SAPbouiCOM.BoSearchKey.psk_ByValue)
Thanks
Shafi -
Setting the jTable column width
Coming from VB6 to Java is hard for me. Syntax is so much different.
Below is what I am doing to populate the jTable and the values are coming from MySQL. My problem is setting the column width but I am having difficult understanding how to do it. I looked on the website and downloaded some examples and clearly because I am new and I simply do not understand it. I was wonder if someone is willing to modify the codes below on how I should do it. Thanks
private void populate_grid(){
Vector dataVector = new Vector();
Vector columnVector = new Vector();
columnVector.add("ID#");
columnVector.add("Account Description");
columnVector.add("Contact");
columnVector.add("State");
while (myResult.next()) {
Vector rowVector = new Vector();
System.out.println(myResult.getString("acct_name"));
rowVector.add(myResult.getString("cust_id"));
rowVector.add(myResult.getString("acct_name"));
rowVector.add(myResult.getString("main_contact"));
rowVector.add(myResult.getString("main_state"));
dataVector.add(rowVector);
jTable1.setModel(new javax.swing.table.DefaultTableModel(dataVector, columnVector));int rows = 3;
int cols = 3;
JTable table = new JTable(rows, cols);
// Disable auto resizing
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
// Set the first visible column to 100 pixels wide
int vColIndex = 0;
TableColumn col = table.getColumnModel().getColumn(vColIndex);
int width = 100;
col.setPreferredWidth(width); -
How to make the jtable celles intouchable !!
HI!
i am using jtable in my application and i am aiming at some specefities:
- i don't wana to allow the uset to drag and drop any cells or to change the order of one cell by another .
- i don't want him to edit a text in any cell of the jtable
actually, to resume everything, i want the jtable to be static one, and not changeable .
any help will be really appreciated.
thankstry importing javax.swing.JTable.*;
there must be another class in javax.swing.*; that also has a getTableHeader() or setReorderingAllowed() method and the compiler is not sure which method to use. When in doubt, always import the specific class you want to use. Example:
TestTable tt = new javax.swing.JTable(); // no confusion with this
// declaration.
At least, I think that should solve your problem. When you import a general library (like swing), there's always the possibility of using methods or fields that can belong to more than one class. Let me know if that works.
James -
How to dimension the JTable columns?
Hello All,
I would like to Know how to choose the horizontal size
of the each JTable columns , I did not find anywhere?
Thanks in advanceYou can try this:
TableColumn column = table.getColumnModel().getColumn( columnIndex );
column.setPreferredWidth( newPreferredWidth );
torsten -
Is there a way to make the last column in finder auto expand?
I know that you can double click the double bar at the bottom right . . . but can't the finder be set to auto expand on the last column so i don't have to click that thing every time i wish to see the long named files ?
Perhaps i should just use Bridge but it seems so slow and cumbersome compared to Finder.
thanks for any advice.
PS . . . is this available on the newest OS . . . going to upgrade one of these days.No, the finder's column view does not have auto resizing columns.
It does have auto condensing of file names for the narrow display.
Which is what you are trying to overcome.
To accomplish your task, switch to list view.
Select your file. Then switch back to column view.
The trick is to learn your FINDER command key short cuts.
command 1 = icon view
command 2 = list view
command 3 = column view.
So you would press [command] and [3] to view the columns.
Navigate about until you get a column of unhelpfully condensed names.
Switch to list view by pressing [command] and [2]
Select the file from the fully displayed names list.
At this point you can press [command] [down arrow] OR [command] [o] to enter/open the selected item;
or Switch back to column view by pressing [command] and [3] then continue browsing deeper.
Maybe you are looking for
-
Can I use a credit card more than once to create an natures
Ok so i
-
Hi, My printer is no longer on my network because we've upgraded the Modem, etc. When I was ready to reconnect it to the network in order to print wirelessly the SET UP ASSITANT is showing on the bottom of the screen as an interrogation mark icon.
-
SD EDI with many partners / best practice
I need some input on how best to approach a large EDI project. We will be accepting orders from about 80 customers. Each one will be drop-shipping products from our warehouse to their customers. I've set up the config for one location to take advat
-
Changing an Attribute Dimension Hierarchy
I've had problems changing custom attribute hierarchies and I'm wondering if others have had similar problems and have a way to get around this. I have an attribute (Program) of my entity field that currently looks like: Program Finance P10001 P1000
-
Deleted messages remove after one day (one week, one month) not working
Has anyone noticed that since the upgrade to iOS 7 automatic email cleanup does not seem to be working? I have an IMAP email account set up with the following setting: Settings > Mail, Contacts, Calendars, [then tap the email account in question] > A