How to make first row as selected in af:table
Hi,
I am using JDeveloper 11.1.1.4 and ADF-BC in my application.
In all the pages across my application we have multi select enabled for the table[af:table].
But when the pages are displayed,the first row is not selected by default.
My requirement is to display first row as selected across all the tables in my app.
I have the selectionListenerset as for example selectionListener="#{bindings.RSCMapVO2.collectionModel.makeCurrent}" in all the pages.
Please suggest on how to make first row as selected.
Regards,
Praveen
Hi
Put these codes in your selection listner method(You have to define a selectionListner method in your backing bean and put this code segment
(Special thanks go to Franks how posted this code segment. threadID=1089583)
RichTable yourTable = (RichTable) selectionEvent.getSource();
//the Collection Model is the object that provides the structured data
//for the table to render
CollectionModel yourTableModel = (CollectionModel) yourTable.getValue();
//the ADF object that implements the CollectionModel is JUCtrlHierBinding. It
//is wrapped by the CollectionModel API
JUCtrlHierBinding yourTableBinding = (JUCtrlHierBinding) yourTableModel.getWrappedData();
//Acess the ADF iterator binding that is used with ADF table binding
DCIteratorBinding yourTableIteratorBinding = yourTableeBinding.getDCIteratorBinding();
//the role of this method is to synchronize the table component selection
//with the selection in the ADF model
Object _selectedRowData = yourTable.getSelectedRowData();
//cast to JUCtrlHierNodeBinding, which is the ADF object that represents
//a row
JUCtrlHierNodeBinding nodeBinding = (JUCtrlHierNodeBinding) selectedRowData;
//get the row key from the node binding and set it as the current row in the
//iterator
Key rwKey = nodeBinding.getRowKey();
tableIteratorBinding.setCurrentRowWithKey(rwKey.toStringFormat(true));
Thanks
Padma
Similar Messages
-
How to make some rows not selectable in AdvancedDataGrid
Hi there,
I have an advanced data grid which allows to select multiple rows. I need to make certain rows not selectable dependent on the row data. How can this be done?
Help is greatly appreciated. Thanks in advance.
--CharmaineHi, You can view same demo here
Thanks and Best regards,
Pallavi Joshi | [email protected] | www.infocepts.com -
How to make a row as selected in output internal table in oops ALV
Hi All,
I have ALV grid output using oops ALV concept, in my output i have a checkbox as first column when i select this checkbox and press a push button 'Print' which is there above ALV grid that particular line in output table should get selected and i need to code some logic for printing selected row.
how to make the particluar row in the output internal table to be selected and where to write the logic for print once it is pressed?
Thanks in advance
Srilakshmi.but the checkbox is not getting set in internal table when i select some checkboxes.
can anybody explain y the checkbox in internal table not set?
Hi Srilakshmi,
As explained by Uwe, when we change a field ( say check box ) in ALV grid, the view (frontend) changes (showing the tick mark) but the changed data ( normally ) is not transfered to the backend.
We can initiate this data transfer by just registering the cl_gui_alv_grid=>mc_evt_modified edit event
go_grid->set_table_for_first_display( CHANGING it_fieldcatalog = pt_fieldcat
it_outtab = pt_outtab ).
go_grid->set_ready_for_input( 1 ).
go_grid->register_edit_event( EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_modified ). " This does the trick
Now as soon as we check a checkbox, the data_changed event is triggered.
This initiates data transfer to the backend and the checkbox field in internal table is updated.
check the below code for example.
DATA: go_cont TYPE REF TO cl_gui_custom_container,
go_grid TYPE REF TO cl_gui_alv_grid,
gt_fieldcat TYPE lvc_t_fcat,
gv_language TYPE spras VALUE 'E',
gt_outtab TYPE TABLE OF bus_loca_demo WITH HEADER LINE.
START-OF-SELECTION.
CALL SCREEN 100.
* MODULE PBO OUTPUT *
MODULE pbo OUTPUT.
SET PF-STATUS 'BASIC'.
SET TITLEBAR '001'.
PERFORM create_and_init_alv CHANGING gt_outtab[]
gt_fieldcat.
ENDMODULE. "pbo OUTPUT
* MODULE PAI INPUT *
MODULE pai INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
SET SCREEN 0. LEAVE SCREEN.
WHEN 'PRINT'.
BREAK-POINT.
ENDCASE.
ENDMODULE. "pai INPUT
FORM create_and_init_alv CHANGING pt_outtab LIKE gt_outtab[]
pt_fieldcat TYPE lvc_t_fcat.
CHECK go_cont IS NOT BOUND.
CREATE OBJECT go_cont
EXPORTING
container_name = 'CUSTOM'.
CREATE OBJECT go_grid
EXPORTING
i_parent = go_cont.
PERFORM build_display_table.
PERFORM build_fieldcat CHANGING pt_fieldcat.
go_grid->set_table_for_first_display( CHANGING it_fieldcatalog = pt_fieldcat
it_outtab = pt_outtab ).
go_grid->set_ready_for_input( 1 ).
go_grid->register_edit_event( EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_modified ). " This does the trick
ENDFORM. "CREATE_AND_INIT_ALV
FORM build_display_table.
FREE gt_outtab.
DO 10 TIMES.
gt_outtab-creation_partner = sy-index.
gt_outtab-date_field = sy-datum.
APPEND gt_outtab.
ENDDO.
ENDFORM. "build_display_table
FORM build_fieldcat CHANGING pt_fieldcat TYPE lvc_t_fcat.
DATA ls_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'BUS_LOCA_DEMO'
CHANGING
ct_fieldcat = pt_fieldcat.
LOOP AT pt_fieldcat INTO ls_fcat.
CASE ls_fcat-fieldname.
WHEN 'CHECKBOX'.
ls_fcat-checkbox = 'X'.
ls_fcat-edit = abap_true.
MODIFY pt_fieldcat FROM ls_fcat.
WHEN 'ENTER_FIELD' OR 'DBLCLICK_FIELD'.
ls_fcat-no_out = abap_true.
MODIFY pt_fieldcat FROM ls_fcat.
ENDCASE.
ENDLOOP.
ENDFORM. "build_fieldcat
Cheers,
Jose. -
How to make first row of JTable bold
I am working with JTable and unable to change to 1st row to BOLD
harshal_2010 wrote:
hi codingMonkey I know that u r very smart guy who doesn't know anythingWow! Could you really deduce that from a simple 'Why?'. Brilliant; absolutely phenomenal!
Oh, and by the way, I hope you like helping yourself. Saying "Hey, you stupid ugly jerk, will you help me with my question?" generally doesn't go down well on these fora. -
How to set the first row as selected in single selection of table
when the page renders how do we make the first row as selected for single selection in a table.
Thansk a lot for your helpset the selection Attribute's value to 'Y' for the first row. Thats enough.
eg;
Row row=vo.first();
row.setAttribute("SelectionAttribute", "Y");
--Prasanna -
How to disable first row selection in a table
Hi,
I have three tables which have master child relationship. I need to enable a button for each table based on row selection of corresponding table.But first row is being selected automatically and the buttons are enabled.
what should i do in order to avoid first row selection in a table.I tried by removing selected Row Keys.But still i am getting the same problem.can anyone suggest on this.
Thank You,
SukumarI know a hack but I don't recommend it, anyway here it goes:
Remove selected Row Keys
Change selectionListener from the default and create a custom action listener (You can call the default one inside of it) (Tip: use makeCurrent function in this PDF
This will make sure that there is no selected row highlighted for the first time, but it actually means that the first row is selected, it's just not shown.
This method is tested with 11.1.1.7 -
How to display first row value returened from a query as checked as default in a report
How to display first row value returned from a query as checked as default in a report
Example
Parameter 1
Paramerter2
ABD
x(checked)
Test
DEF
JMG
MudassarHi Mudassar,
The issue is caused by the order in which the parameters appear in the report data tab can be difference between our report execution and it failing. In other words, “Parameter2” is execution before parameter “A” due to this issue. We can adjust the parameter’s
order to solve the issue.
If “Parameter2” is parameter “A”, we cannot use that expression. Because fields cannot be used in report parameter expression, if we want to display the first value returned from a query as default value, we have to fill the “Specify values” text box with
the specific value in Default Values dialog box.
Regards,
Alisa Tang
Alisa Tang
TechNet Community Support -
How display number of row in select statement
How can I display number of row in select statement?
Table
data1 data2
xxx ccd
wss qwe
qws uij
I need get from SELECT statement:
1 xxx ccd
2 wss qwe
3 qws uijuser13734495 wrote:
Thank you from answer.
Statement
select rownum rn, data1, data2 from table
is good.
And what have I do went I use
select rownum rn, data1, data2 from table order by data1
and I get
3 qws uij
2 wss qwe
1 xxx ccd
I need
1 qws uij
2 wss qwe
3 xxx ccdhence the importance of describing the complete problem.
select
rownum,
data1,
data2
from(
select
data1,
data2
from
table
order by
data1) -
How to make default values in selection field?
hi,
i have selection field date , using data element 'QENTST' using following code in view INIT Method. i get the input selection field when i test application.
DATA: LT_RANGE_TABLE TYPE REF TO DATA.
CALL METHOD WD_THIS->M_HANDLER->CREATE_RANGE_TABLE
EXPORTING
I_TYPENAME = 'QENTST'
RECEIVING
RT_RANGE_TABLE = LT_RANGE_TABLE.
CALL METHOD WD_THIS->M_HANDLER->ADD_SELECTION_FIELD
EXPORTING
I_ID = 'QENTST'
IT_RESULT = LT_RANGE_TABLE
I_OBLIGATORY = ABAP_TRUE.
What i need now , to make default value in this selection field( low = sy-datum and high = sy-datum + 10 ) . I have checked , i found one method called... SET_RANGE_TABLE_OF_SEL_FIELD. Bt i m not able to understand how to assign values to input table parameter in this method?
Thanks In Advance.
Saurin ShahHi,
Refer this Article by Thomas on how to make default values in Select Options:
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60474842-91ca-2b10-3390-d2fd30f335fd
I hope it would solve your problem. -
How to make a field in selection screen as READ_ONLY !!
Hi,
How to make a field in selection screen as READ_ONLY !!.
Thanks,
SenthilThis is the code you need to have in your program.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF SCREEN-NAME = 'MYSELFLD'.
SCREEN-INPUT = 0.
MODIFY-SCREEN.
ENDIF.
ENDLOOP. -
How to make required field on selection screen in Query
i'm now working with query(SQ01).
but don't know how to make required field on selection screen in Query.
thanks in advancei'm now working with query(SQ01).
but don't know how to make required field on selection screen in Query.
thanks in advance -
How to customize some rows default selected in tableSelectMany
Hi all,
How to set some rows default selected in tableSelectMany
Thanks
JaysonIf you bind table to managed bean attribute using binding property you may preselect some rows in getter of that attribute.
private RichTable _t;
public RichTable get_t() {
//select few rows here or all...
_t.getSelectedRowKeys().addAll();
return _t;
{code} -
How to make the row as a hyperlink in Crystal 2008
Hi,
Could you give me advise on how to make the row as a hyperlink and call another report.
Thank you in advance.
RoseHi Sastry,
I was able to create the subreport and its working.
Thank you so much.
Regards.
Rose -
Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the records?
Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.The Oracle documentation has a good overview of the options available
Generating XML Data from the Database
Without knowing your version, I just picked 11.2, so you made need to look for that chapter in the documentation for your version to find applicable information.
You can also find some information in XML DB FAQ -
How to make the diagonal line in the swing table cell?
Hi all,
How to make the diagonal line in the swing table cell just like the link below?
http://61.132.17.188/webber/table.gifOne improvement.. To get a line that is neat, use a bit of Graphics2D
public void paintComponent(java.awt.Graphics g)
int w = getSize().width;
int h = getSize().height;
// draw a line between (0,0) and (w,h)
g.setColor(getForeground());
if (strTop == null)
strTop = " ";
if (strBottom == null)
strBottom = " ";
java.awt.Graphics2D g2 = (java.awt.Graphics2D)g;
g2.setRenderingHint(java.awt.RenderingHints.KEY_ANTIALIASING,java.awt.RenderingHints.VALUE_ANTIALIAS_ON);
//g2.setStroke(new java.awt.BasicStroke(14.0f));
g.drawLine(0, 0, w, h);
//the following lines will draw the two strings,
//one above the top of the line and the above below it.
g2.drawString(strTop, (w/2)+2, (h/2)-2);
g2.drawString(strBottom, 2, (h / 2) + 2);
//the x,y for drawString are only based on assumption. //do necessary changes to suit ur needs.
}Then create a TableCellRenderer and set it to the Table Header for ur table's 1st row.....
Cheers
Maybe you are looking for
-
Need Help -- after hard reset sync issues
Hi My Centro was frozen and I performed a hard reset. Everything was backed up on my computer. I synced it, worked fine. Problem is when I sync it again, EVERY time it sees the device as new and asks me if I want to name it or sync with the old de
-
IMovie muddies perfectly crisp pngs
Hi, Admittedly spiral-eyed now, I have read everything that I can google, etc, re: iMovie lowering image quality, but can't find anything specific to this problem: I am creating a 47-second movie for iOS applications. I have an iMovie 9.0.4 project t
-
Another Java Thread...(not working in any browser)
Alright so here's the story. For some time my wife has been wanting a Macbook to make her schooling easier, everyone has one and they all say it's amazing. Now here comes the tricky part, her gaming habits include a game called Runescape, a Java ba
-
My iPod just stopped working, it won't even turn on ... what should I do?
-
I've got Photoshop Elements 11 on my mac-book Now I want to copy the programm to my Mac Pro too. Is it possible or do I have to buy another license?