Adding a check box control for each row of data in a DataModel
Hi all,
I need to add a checkbox control for each row of data on a DataModel object.
I have a "commandButton" at the bottom of DataModel, and whenever someone checks some of the rows on that list of rows,
I need to get the selected dataModel(fragment of the list) in my backing bean.
How do I achieve this functionality in JSF?
Thanks,
Meghasyam.
Hi all,
I need to add a checkbox control for each row of data
on a DataModel object.
I have a "commandButton" at the bottom of DataModel,
and whenever someone checks some of the rows on that
list of rows,
I need to get the selected dataModel(fragment of the
list) in my backing bean.
How do I achieve this functionality in JSF?
Thanks,
Meghasyam.You'll want to have a wrapper class as suggested above, which has a "selected" boolean in it. Then use the "binding" attribute of the h:selectBooleanCheckbox component to bind the checkbox to that property... Make the property public and specify the properties exact name in the binding... bindings do not append "get" to the EL.
Here is an example of what your table might look like... This code would display the list of names with a checkbox to the left of each name... When the check box is selected, the "selected" property of that wrapper class is set to true or false as needed. Then when the form is submitted, and you are inside your actionListener or action method call, you can look through your collection of wrapper classes asking each one if it was selected or not... Then do whatever you want with them... In this example, replace "myBackingBean" with the name of your backing bean, and "names" with the name of the method in your backing bean which returns the collection of wrapper classes... create a flag "public boolean selected" or similar in your wrapper class..
<h:dataTable id="namestable"
value="#{myBackingBean.names}"
var="aName">
<h:column>
<h:selectBooleanCheckbox binding="#{aName.selected}"/>
<h:outputText value="#{aName.nameText}"/>
</h:column>
</h:dataTable>
Let me know if that isn't clear enough and I'll see if I can find a better way to explain it...
-Garrett
Similar Messages
-
How to automate the adding of check-box along with each numbered item in Framemaker file ?
I tried using the wingdings font as check-box. But I don't want to use it manually every time. I want to have it as a style part of my procedure style (numbering style). I need the check-box along with each numbered item. Whenever I apply my numbering style in FM, I should get something like:
" <checkbox> 1. <text> "Use "N:\u2751\ <n+>.\ " for the autonumber format.
"N" Use counter N
"\u2751" One of many checkboxes available in Unicode
"<n+>" increment the counter
"." ordinary period
"\ " non-breaking space
This assumes that you are on FM8 or later, and your Unicode font has that glyph code point populated (Arial Unicode MS does if your font doesn't).
Don't use WingDings (or Zaph Dingbats) anymore. Using codepage overlays has any number of issues, and these two sets of legacy codepage dingbats don't even match each other. -
Check Box for each row in report -- all rows deleting when pressing DELETE
Hello experts! I have set up a report with a check box for each row. When I click the DELETE button to delete the selected rows, every single one of the rows get deleted...even the ones that are not selected. I have my process point set to "On Submit - After computations and validations".
This is my delete process (SHG is the table and SHG_ID is the primary key):
FOR i in 1..HTMLDB_APPLICATION.G_F01.count
LOOP
DELETE FROM SHG
WHERE SHG_ID = HTMLDB_APPLICATION.G_F01(i);
END LOOP;
Also, I've added to query in the region source this line:
htmldb_item.checkbox(1, SHG_ID) del,
Where does the "1" come into this? Not sure what I am doing wrong!
Message was edited by:
user477193
Message was edited by:
user477193The 1 (first argument to all the htmldb_item.* APIs) corresponds to the array number in htmldb_application.g_fNN. So 1 will populate array g_f01, 2 will populate g_f02 and so on.
Your code seems fine, it should delete only the checked rows. Are you sure there is no other process on the page that might be deleting the rows? See if you can put up an example on htmldb.oracle.com -
Different values in a list box for each row of the table control...
Dear Experts,
Is it possible to populate different values for each row in a listbox inside a table control ?
Example,
Row 1 in the the table contains A, B & C
Row 2 in the same table contains C, D & E
If yes, How?
yes i am using
call function 'VRM_SET_VALUES'
exporting
id = i_name
values = i_list.
Thank you .
Message was edited by:
Kokwei Wong
Message was edited by:
Kokwei WongHi Wong,
this is code example for listbox
TYPE-POOLS vrm .
DATA: lt_vrm_values TYPE TABLE OF vrm_value.
DATA: wa_vrm_values TYPE vrm_value.
PARAMETER p_list AS LISTBOX VISIBLE LENGTH 10.
INITIALIZATION.
wa_vrm_values-key = 'Key1'.
wa_vrm_values-text = 'Value1'.
APPEND wa_vrm_values TO lt_vrm_values.
wa_vrm_values-key = 'Key2'.
wa_vrm_values-text = 'Value2'.
APPEND wa_vrm_values TO lt_vrm_values.
wa_vrm_values-key = 'Key3'.
wa_vrm_values-text = 'Value3'.
APPEND wa_vrm_values TO lt_vrm_values.
AT SELECTION-SCREEN OUTPUT.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'P_LIST'
values = lt_vrm_values
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
IF sy-subrc 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
To fill it with data from DB, just do select in INITIALIZATION and put that values with same alghoritmus.
Manas M.
P.S.: This is very easy question, you should use search ... -
Use labview to read an Excel file to some control and add a checkbox for each row
As the subject say,I need to use labview to read an excel file,and show it in some control,such as mclb;then ,I should add an checkbox for each row,enable me to choose the row i want.What should I do ? Many Thanks.
Solved!
Go to Solution.Hi,
to answer your question:
- read an excel file
- show it in some control, such as a MCLB
- add an checkbox for each row
- choose the row you want
Hint to make it easier: I wouldn't use checkboxes, as the MCLB already allows to select rows by mouseclick…
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome -
Drop Down List in a table - different options for each row
How can i have a drop down list in a table with different options for each row?
My requirement is this.. I want to display, say employee dtails in a table, and one column is employee hobbies, whcih can have multiple values and each employee may have a different list of hobbies. So how can we populate the drop down for each row, with different options?Hey. Uh, this probably isn't the answer you were looking for, but it sounds like you've got a problem with your database design there. Generally speaking, your tables shouldn't have multi-valued fields, in the relational model anyway (sql). Instead, you should look at adding a separate table like EMPLOYEE_HOBBIES. Then you have a foreign key using the employees primary key as the foreign key in the employee_hobbies table, see what I mean? I might have misunderstood your explanation though, I'm not sure.
Alternatively, you could just have hobbies as a big freeform varchar field, and don't bother to make people separate their hobbies into different fields (you'd have to abandon the drop-down listbox idea in this case). If there's no really important reason to make the distinction, then it's probably easier just to not do it. -
How to get control on each row in advance table
hi, i have a advanced table with some data, in each row i have two radio buttons which i need to set depending on some column value in the row, i tried by following code
for(SoftCompVORowImpl row2 = (SoftCompVORowImpl)svo.first();row2!=null;row2=(SoftCompVORowImpl)svo.next())
if(row2.getAttribute("CommitEndDate")==null || row2.getAttribute("CommitEndDate").equals(""))
onetime.setSelected(true);
recurring.setSelected(false);
else
onetime.setSelected(false);
recurring.setSelected(true);
but this code is making set only one radio button (onetime), which ever i am making first true its getting selected, i need to know how to get control of each row....Babu,
Basically you should use the decode function in your sql query itself and attach it with BC4J properties of radio buttons.In that case you don't have to worry about setting them declaratively !
--Mukul -
Update button in sql report for each row can only get the report value
I have to added Update for each row of records like:
select a.*,'Update' button from (
select c.*,d.login from country c,champ d
where c.champ_id=d.champ_id(+)
order by c.name) a
then go to the report->edit button ->Column Link
I added some items P40_REGION, P40_CHAMPID,P40_ACTIVE,P40_CODE and assign the value like #region#,#active# ,#code# to these item, but when I click the update button in the report I found the values such as #region#,#active# ,#code# is the report value not the select list selected value(the region, active column are displayed as select list lov).
Can anyone tell me how to sort this knid of problem?
Thanks a lot!Sorry, it doesn't work. I also tried apex_application.g_f01(i), but not everytime I can get the value or get the incorrect value. If you have time you can try to create it like what I have described. Our team use two days now but still can not sort this problem.
-
Prompting user for input for each row in the report
Is it possible to have a user entered field for each row in a report ?
ie. have a report with empolyee number, employee name, title, salary, and comment. Select of of these columns from the SQL query except for the comment, and then when the report is generated have the user be prompted for what the want the comment to be for every employee in the report?That is, have the user generating the report enter in a different comment for EACH employee. (ie Joe Smith's comment is "good worker and John Smith's comment is "come to work late on Tuesdays and Thursdays", Sally Jones' comment is "Expert in C++" etc.) as the reports is being built for each row returned from the query.
-
How to process a block for each row in an internal table....
Hi experts....
In po approval workflow the scenario is like this.... for each po there may be more than one approver. approvers list i am maintaining in the ztable. list of approvers(no of approvers) is decided by the po value. I have collected these approvers into internal table. now i have to process a block ( approving or rejecting the po... )in the workflow for each row in the internal table.
how can i do this. based on the decision of the 1st approver approves the po then it should go to next approver in the internal table...otherwise end the workflow.....
Please help me......i have created an internal table in the workflow container in which i am getting the list of approvers....
how can i loop the internal table in the workflow...?
how can i know the index of the loop in the workflow.....(will sy-index work here....? so that i can use loop until step in the main workflow to call the subworkflow..so that if sy-index is greater than no of entires in the itab then i can come out of the loop) -
I'm trying to get the count for each row to total count for each month
Something like this
Hardware | Jan
Monitors | 5
Processors | 137
Printers | 57
etc........
How can I write a query for this. I can get the Hardware column but don't know how to get the next column.If you can provide more data like sample input DML statements it would have been wonderful..
Assuming is , you need a pivot. Here is an article on basic Pivot..
http://sqlsaga.com/sql-server/how-to-use-pivot-to-transform-rows-into-columns-in-sql-server/
something like this may be..
DECLARE @Input TABLE
Hardware VARCHAR(20),
[Date] VARCHAR(20)
INSERT INTO @Input VALUES('Monitor', '01/01/2014'), ('CPU', '01/01/2014'), ('Monitor', '01/03/2014')
, ('ABC', '01/01/2014'),('Monitor', '02/01/2014')
;WITH CTE AS
SELECT Hardware, LEFT(DATENAME(M, [Date]),3) AS [MonthName] FROM @Input
SELECT *
FROM
SELECT Hardware, [MonthName], COUNT(Hardware) AS Count FROM CTE GROUP BY Hardware, [MonthName]) a
PIVOT (MAX([Count]) FOR [MonthName] IN ([Jan], [Feb])) pvt
Please mark as answer, if this has helped you solve the issue.
Good Luck :) .. visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles. -
How to add a comment for each row on the output of a report?
I would like to add a comment (field) for each row on the output of report? This comment should to be saved as well. Is there a way i can do that?
Regards,
RamHi Dimitri,
through the instead of trigger functionality i am able to update the view. This is view is based on different views which should be linked to a table (as you suggested) in which comments can be stored. Hower this table is empty and how to link this table with the view now? I face the following challenge.
View consists the following columns, for example
select name, sex, age from test_view
name sex age
John M 20
Anton M 30
Willy M 40
shirley F 38
sharon F 37
The report has the following output, for example
name sex age
John M 20
Anton M 30
Willy M 40
Shirley F 38
Sharon F 37
Now i would like to add comment through a button.
The report layout looks like
name sex age
John M 20 <add comment button>
After submitting the <add comment button> you can enter text which deals with John
text='John doesnot like me'
Finally the report display the comment as well
name sex age
John M 20 'John doesnot like me' <update/delete comment button>
Anton M 30 <add comment button>
Willy M 40 <add comment button>
Shirley F 38 <add comment button>
Sharon F 37 <add comment button>
After submitting the <update/delete button> you can change or delete the entered text.
I hope this example clears things up.
Regards,
Ram -
For each row of a table call a pl/sql function
Hi,
i have a search form in adf like this:
parameter1:___
parameter2:____
buttonSearch
Table with results
field1 field2 field3
row1 ------ --------- -------
row2 ------ --------- -------
row3 ------ --------- -------
The user inputs the parameters 1 and 2 then press buttonSearch and the query execute and returns rows 1 to 3.
What i need is for each row call pl/sql function and passed the parameter 1 and 2 and field 1 to 3 (plsql function recives 5 parameters (parameter1, parameter2, field1 , field2 and field3) )
my buttonSearch call a java class that execute ExecuteWithParamters method.
I create the call to my plsql function on Application module class and then export as a java interface.
So i have the function to use in the viewcontroller layer, but i don't know where to use it, and how to pass the paramters: the parameter 1 and 2 that user inputs and the row fields.....
any ideas....
thanks!!Hi,
for this you need to call the PLSQL function upon table rendering, which means that you need a field in the table referencing a managed bean. In the managed bean you can use #{row} and resolve it using a ValueExpression. #{row} gives you access to the current rendered row (this is why you need to do it when the table renders) and thus allows you to call getAttribute(name) to get the values of field 1 - 3. The search field value you should get through the bindings reference (assuming the search form uses ADF). Then you create an operation binding for the executeWithParameters and call operationBindingName.getParamsMap().put(argname, argvalue); on it.
Frank
Ps.: I am concerned about the performance you get and wonder if it isn't possible to create a transient attribute that executes the function and displays the results. As I understand, the search parameters are only to filter the result set, which you still can do -
Make select for each row - another solution?
For example I have a function with day before selection:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
function ABS return boolean is
ret number(10,2);
begin
for sab in (select saldod from ndv_ccli, nd_clientes where
(:p_dtvenc-dtdoc) = (select min(:p_dtvenc-dtdoc) from ndv_ccli, nd_clientes
where (:p_dtvenc-dtdoc>0)and
ndv_ccli.cod_cli = cod_cli) and
ndv_ccli.cod_cli = cod_cli order by dtdoc desc,cddb )
loop
ret := sab.saldod;
end loop;
return (ret);
end;
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
In report I use the value of this function(a) in another function(b) to sum with few values.
Output of function(b) has a lot of rows and for each row it makes select in function(a) to find the value, but actualy it is the same. Is it possible to do this select only one time and then put in function(b) only it's value? Because it makes report too slow...
tnx beforeThanx, but while compiling it says:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
REP-0749: After form trigger cannot reference a report column.
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -
SQL merge and after insert or update on ... for each row fires too often?
Hello,
there is a base table, which has a companion history table
- lets say USER_DATA & USER_DATA_HIST.
For each update on USER_DATA there has to be recorded the old condition of the USER_DATA record into the USER_DATA_HIST (insert new record)
- to have the history of changes to USER_DATA.
The first approach was to do the insert for the row trigger:
trigger user_data_tr_aiu after insert or update on user_data for each rowBut the performance was bad, because for a bulk update to USER_DATA, there have been individual inserts per records.
So i tried a trick:
Instead of doing the real insert into USER_DATA_HIST, i collect the USER_DATA_HIST data into a pl/sql collection first.
And later i do a bulk insert for the collection in the USER_DATA_HIST table with stmt trigger:
trigger user_data_tr_ra after insert or update on user_dataBut sometimes i recognize, that the list of entries saved in the pl/sql collection are more than my USER_DATA records being updated.
(BTW, for the update i use SQL merge, because it's driven by another table.)
As there is a uniq tracking_id in USER_DATA record, i could identify, that there are duplicates.
If i sort for the tracking_id and remove duplicate i get exactly the #no of records updated by the SQL merge.
So how comes, that there are duplicates?
I can try to make a sample 'sqlplus' program, but it will take some time.
But maybe somebody knows already about some issues here(?!)
- many thanks!
best regards,
FrankHello
Not sure really. Although it shouldn't take long to do a test case - it only took me 10 mins....
SQL>
SQL> create table USER_DATA
2 ( id number,
3 col1 varchar2(100)
4 )
5 /
Table created.
SQL>
SQL> CREATE TABLE USER_DATA_HIST
2 ( id number,
3 col1 varchar2(100),
4 tmsp timestamp
5 )
6 /
Table created.
SQL>
SQL> CREATE OR REPLACE PACKAGE pkg_audit_user_data
2 IS
3
4 PROCEDURE p_Init;
5
6 PROCEDURE p_Log
7 ( air_UserData IN user_data%ROWTYPE
8 );
9
10 PROCEDURE p_Write;
11 END;
12 /
Package created.
SQL> CREATE OR REPLACE PACKAGE BODY pkg_audit_user_data
2 IS
3
4 TYPE tt_UserData IS TABLE OF user_data_hist%ROWTYPE INDEX BY BINARY_INTEGER;
5
6 pt_UserData tt_UserData;
7
8 PROCEDURE p_Init
9 IS
10
11 BEGIN
12
13
14 IF pt_UserData.COUNT > 0 THEN
15
16 pt_UserData.DELETE;
17
18 END IF;
19
20 END;
21
22 PROCEDURE p_Log
23 ( air_UserData IN user_data%ROWTYPE
24 )
25 IS
26 ln_Idx BINARY_INTEGER;
27
28 BEGIN
29
30 ln_Idx := pt_UserData.COUNT + 1;
31
32 pt_UserData(ln_Idx).id := air_UserData.id;
33 pt_UserData(ln_Idx).col1 := air_UserData.col1;
34 pt_UserData(ln_Idx).tmsp := SYSTIMESTAMP;
35
36 END;
37
38 PROCEDURE p_Write
39 IS
40
41 BEGIN
42
43 FORALL li_Idx IN INDICES OF pt_UserData
44 INSERT
45 INTO
46 user_data_hist
47 VALUES
48 pt_UserData(li_Idx);
49
50 END;
51 END;
52 /
Package body created.
SQL>
SQL> CREATE OR REPLACE TRIGGER preu_s_user_data BEFORE UPDATE ON user_data
2 DECLARE
3
4 BEGIN
5
6 pkg_audit_user_data.p_Init;
7
8 END;
9 /
Trigger created.
SQL> CREATE OR REPLACE TRIGGER preu_r_user_data BEFORE UPDATE ON user_data
2 FOR EACH ROW
3 DECLARE
4
5 lc_Row user_data%ROWTYPE;
6
7 BEGIN
8
9 lc_Row.id := :NEW.id;
10 lc_Row.col1 := :NEW.col1;
11
12 pkg_audit_user_data.p_Log
13 ( lc_Row
14 );
15
16 END;
17 /
Trigger created.
SQL> CREATE OR REPLACE TRIGGER postu_s_user_data AFTER UPDATE ON user_data
2 DECLARE
3
4 BEGIN
5
6 pkg_audit_user_data.p_Write;
7
8 END;
9 /
Trigger created.
SQL>
SQL>
SQL> insert
2 into
3 user_data
4 select
5 rownum,
6 dbms_random.string('u',20)
7 from
8 dual
9 connect by
10 level <=10
11 /
10 rows created.
SQL> select * from user_data
2 /
ID COL1
1 GVZHKXSSJZHUSLLIDQTO
2 QVNXLTGJXFUDUHGYKANI
3 GTVHDCJAXLJFVTFSPFQI
4 CNVEGOTDLZQJJPVUXWYJ
5 FPOTZAWKMWHNOJMMIOKP
6 BZKHAFATQDBUVFBCOSPT
7 LAQAIDVREFJZWIQFUPMP
8 DXFICIPCBCFTPAPKDGZF
9 KKSMMRAQUORRPUBNJFCK
10 GBLTFZJAOPKFZFCQPGYW
10 rows selected.
SQL> select * from user_data_hist
2 /
no rows selected
SQL>
SQL> MERGE
2 INTO
3 user_data a
4 USING
5 ( SELECT
6 rownum + 8 id,
7 dbms_random.string('u',20) col1
8 FROM
9 dual
10 CONNECT BY
11 level <= 10
12 ) b
13 ON (a.id = b.id)
14 WHEN MATCHED THEN
15 UPDATE SET a.col1 = b.col1
16 WHEN NOT MATCHED THEN
17 INSERT(a.id,a.col1)
18 VALUES (b.id,b.col1)
19 /
10 rows merged.
SQL> select * from user_data_hist
2 /
ID COL1 TMSP
9 XGURXHHZGSUKILYQKBNB 05-AUG-11 10.04.15.577989
10 HLVUTUIFBAKGMXBDJTSL 05-AUG-11 10.04.15.578090
SQL> select * from v$version
2 /
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - ProductionHTH
David
Maybe you are looking for
-
Enq: TX - row lock contention
DB version: 10.2.0.3 Could someone provide the possible reasons for this type of lock. I have an update locks atleast once or more a day with this type of lock and will not be finished until I kill off the session. I have run query below and also sev
-
Hi, We have 30 points in a check list to verify whether all of them are checked or not during a opeartion execution? is it possible to send all these 30 points/ sentenses in a single pi sheet to the operator? is there any limitation in number of mess
-
Stand-Alone exe not seeing my VISA instruments
Hello, I am attempting to build a standalone installer application from my VI using LV 7.1 on a Win 2k machine. I have gone through the build application wizard making sure to enable hardware configuration checkbox and select the desired VISA TCP/IP
-
Can I change the default library upon startup?
When iTunes launches, it always selects the "Music" library, the top setting in the upper-left. I use a "shared" music server exclusively. It would be good to have that as the default, either by reordering the list or specifying this entry as a defau
-
HELP! ISSUE UPDATING DATABASE RECORDS
Hi All Thank you for looking at my post. I have a form which interacts with a SQL database. The process starts with one member of the team partially completing the form and submitting this. xfa.sourceSet.DataConnection.addnew(); on form initiaise fun