Button click row identification in af:table
i have an af:table whose 1 column contains buttons. Clicking on each button i want to do some step. How do i determine which button was clicked (which row) ?
its an adf faces project.
thnks
The suggestion provided by Timo Should work.
Here, is an sample based on Employees Table based on HR Schema.
Ensure that the selection listener for the table is selected as single.
JSPX Page:
<af:form id="f1">
<af:table value="#{bindings.Employees.collectionModel}" var="row"
rows="#{bindings.Employees.rangeSize}"
emptyText="#{bindings.Employees.viewable ? 'No data to display.' : 'Access Denied.'}"
fetchSize="#{bindings.Employees.rangeSize}"
rowBandingInterval="0"
*selectedRowKeys="#{bindings.Employees.collectionModel.selectedRow}"*
*selectionListener="#{bindings.Employees.collectionModel.makeCurrent}"*
*rowSelection="single"*
id="t1">
<af:column sortProperty="EmployeeId" sortable="true"
headerText="#{bindings.Employees.hints.EmployeeId.label}"
id="c4">
<af:outputText value="#{row.EmployeeId}" id="ot2">
<af:convertNumber groupingUsed="false"
pattern="#{bindings.Employees.hints.EmployeeId.format}"/>
</af:outputText>
</af:column>
<af:column sortProperty="FirstName" sortable="true"
headerText="#{bindings.Employees.hints.FirstName.label}"
id="c1">
<af:outputText value="#{row.FirstName}" id="ot3"/>
</af:column>
<af:column sortProperty="LastName" sortable="true"
headerText="#{bindings.Employees.hints.LastName.label}"
id="c3">
<af:outputText value="#{row.LastName}" id="ot4"/>
</af:column>
*<af:column headerText="#{'View Details'}" id="c2">*
*<af:commandButton text="View Details" id="cb1"*
*actionListener="#{SamplePageBean.onClick}"/>*
*</af:column>*
</af:table>
</af:form>
*Bean Code:*
import javax.faces.event.ActionEvent;
import oracle.adf.model.BindingContext;
import oracle.adf.model.binding.DCBindingContainer;
import oracle.adf.model.binding.DCIteratorBinding;
public class SamplePageBean {
public SamplePageBean() {
public void onClick(ActionEvent actionEvent) {
DCBindingContainer dcBindings =
(DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
// Get a attribute value of the current row of iterator
DCIteratorBinding iterBind =
(DCIteratorBinding)dcBindings.get("EmployeesIterator");
String firstName =
(String)iterBind.getCurrentRow().getAttribute("FirstName");
String lastName =
(String)iterBind.getCurrentRow().getAttribute("LastName");
System.out.println(firstName + " " + lastName);
Thanks,
Navaneeth
Similar Messages
-
How to diplay table row dynamically by button click
Hi All,
I had a table with with visible row count '3', i want to display dynamic row by a button click, mean a 4 th row need to be added to the table with same like row '3'.
please help me ..
Thanks,
Raj.Hi Raju,
while click the Add Button,
Get the all the Rows from the Table and Put it in to one internal table . after that append the one empty record to that internal table. then again bind to that node.
Like following code.
DATA lo_nd_sales TYPE REF TO if_wd_context_node.
DATA lo_el_sales TYPE REF TO if_wd_context_element.
DATA ls_sales TYPE wd_this->element_sales.
DATA lt_sales TYPE wd_this->elements_sales.
navigate from <CONTEXT> to <SALES> via lead selection
lo_nd_sales = wd_context->get_child_node( name = wd_this->wdctx_sales ).
get element via lead selection
lo_el_sales = lo_nd_sales->get_element( ).
CALL METHOD lo_nd_sales->get_static_attributes_table
EXPORTING
from = 1
to = 2147483647
IMPORTING
table = lt_sales
IF lt_sales IS NOT INITIAL.
CLEAR ls_sales.
APPEND ls_sales TO lt_sales.
lo_nd_sales->bind_table( lt_sales ).
ENDIF.
Regards,
Vijay. -
BUTTON CLICK ON SEARCH ITEM CAUSES OTHER REGIONS (FORM) IN TABLE TO ERRORS
Hello,
I dont know if I have come to a limitation or flaw of the XE or is it me who does not know how to. (probably me)
The thing is that I have in one page, one standard form for entering data and one report output table to show them. This output table has incorporated that built-in feature of Search
Now, what happens, if I click on the search button to locate a record in the Report table, as the full page reloads, then the Form region also loads but as it has no data, in the effect of being reloaded activates its button of submit, bringing my report table to all errors as it is getting null values which are not allowed. I really need the search feature because otherwise users can have the more and more unconfortable time to locate things as the table grows to thousands of rows.
any help would be greatly appreciated
kindest regards
AlvaroHi,
My first option probably do not even work. I did mean put expression "GO" as I understand go button submit request GO.
And now when I think it is validations that gives those errors. Right ?
So you need set that condition "PL/SQL function body returning a Boolean" to after submit validations
RETURN :REQUEST IN('SAVE','CREATE');Sorry, about confusion
Automatic Row Processing (DML) process that actually insert/update/delete is anyway run only when certain submit requests
>
Valid Update Request Values: SAVE, APPLY CHANGES, UPDATE, UPDATE ROW, CHANGE, APPLY, APPLY%CHANGES%, GET_NEXT%, GET_PREV%
Valid Insert Request Values: INSERT, CREATE, CREATE_AGAIN, CREATEAGAIN
Valid Delete Request Values: DELETE, REMOVE, DELETE ROW, DROP
>
Br, Jari -
Selecting all rows in ALV on a button click
Hi Experts
Hi,
I have a dynamic ALV table. I also have a button 'Select All Rows'. On clicking the button I want all the rows in the ALV table selected which is done by using set_selected method at the context node.
All the rows in the alv is selected after clicking select_all except for the first row.
Need your inpts to solve the same.
Regards
KarthickUse the folowing code
*... get model
data:
lr_model type ref to cl_salv_wd_config_table.
lr_model ?= me->r_model.
*... get columns
data:
ls_column type salv_wd_s_column_ref,
lt_column type salv_wd_t_column_ref.
lt_column = lr_model->if_salv_wd_column_settings~get_columns( ).
data:
l_selected type abap_bool.
loop at lt_column into ls_column.
l_selected = abap_false.
read table value transporting no fields with key column = ls_column-id.
if sy-subrc eq 0.
l_selected = abap_true.
endif.
try.
me->if_salv_bs_model_column~set_selected(
column = ls_column-id
value = l_selected ).
catch cx_salv_bs_sc_object_not_found. "#EC NO_HANDLER
endtry.
endloop. -
How to move a row to top in a report on button click
Hi,
I have a report and have 2 buttons(Top and Bottom). When I click on top button selected row should be moved to top in the list, when I click on bottom that select row should be moved to bottom. I checked Denes reorder rows example it has only up and down functionality.
Could some one help me in doing that.
Thanks in advance,
SriHello, maybe I don´t get your problem, but I would just use: single table, form subform for row with positioned (manually like 2 rows) or flowed (with two "internal" subforms to help achieve 2-like-row-design of the row) content and that´s all. Otto
p.s.: if your problem is not that simple then I don´t get it, please clarify -
How to get current row(Based on Radio button check) submit button Click
Hi i hava Query Region Search(Based On Auto Customization Criteria).
For Showing Results iam Using Table Region.
Using Radio button How we get the row reference value using Submit button Click.
Please Help on this .
Thanks & Regards
SanHi san ,
Try this
if ("EventID".equals(pageContext.getParameter(EVENT_PARAM)))
String rowRef = pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
OARow row = (OARow)am.findRowByRef(rowRef);
VORowImpl lineRow = (YourVORowImpl)findRowByRef(rowRef); // Replace your vo name .
Please refer this link , Let me know if its not clear .
Single Selection in table Region in OAF .
Keerthi -
How to move a selected row data from one grid to another grid using button click handler in flex4
hi friends,
i am doing flex4 mxml web application,
i am struck in this concept please help some one.
i am using two seperated forms and each form having one data grid.
In first datagrid i am having 5 rows and one button(outside the data grid with lable MOVE). when i am click a row from the datagrid and click the MOVE button means that row should disable from the present datagrid and that row will go and visible in the second datagrid.
i dont want drag and drop method, i want this process only using button click handler.
how to do this?
any suggession or snippet code are welcome.
Thanks,
B.venkatesan.Hi,
You can get an idea from foolowing code and also from the link which i am providing.
Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
width="613" height="502" viewSourceURL="../files/DataGridExampleCinco.mxml">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.binding.utils.BindingUtils;
[Bindable]
private var allGames:ArrayCollection;
[Bindable]
private var selectedGames:ArrayCollection;
private function initDGAllGames():void
allGames = new ArrayCollection();
allGames.addItem({name: "World of Warcraft",
creator: "Blizzard", publisher: "Blizzard"});
allGames.addItem({name: "Halo",
creator: "Bungie", publisher: "Microsoft"});
allGames.addItem({name: "Gears of War",
creator: "Epic", publisher: "Microsoft"});
allGames.addItem({name: "City of Heroes",
creator: "Cryptic Studios", publisher: "NCSoft"});
allGames.addItem({name: "Doom",
creator: "id Software", publisher: "id Software"});
protected function button1_clickHandler(event:MouseEvent):void
BindingUtils.bindProperty(dgSelectedGames,"dataProvider" ,dgAllGames ,"selectedItems");
]]>
</mx:Script>
<mx:Label x="11" y="67" text="All our data"/>
<mx:Label x="10" y="353" text="Selected Data"/>
<mx:Form x="144" y="10" height="277">
<mx:DataGrid id="dgAllGames" width="417" height="173"
creationComplete="{initDGAllGames()}" dataProvider="{allGames}" editable="false">
<mx:columns>
<mx:DataGridColumn headerText="Game Name" dataField="name" width="115"/>
<mx:DataGridColumn headerText="Creator" dataField="creator"/>
<mx:DataGridColumn headerText="Publisher" dataField="publisher"/>
</mx:columns>
</mx:DataGrid>
<mx:FormItem label="Label">
<mx:Button label="Move" click="button1_clickHandler(event)"/>
</mx:FormItem>
</mx:Form>
<mx:Form x="120" y="333">
<mx:DataGrid id="dgSelectedGames" width="417" height="110" >
<mx:columns>
<mx:DataGridColumn headerText="Game Name" dataField="name" width="115"/>
<mx:DataGridColumn headerText="Creator" dataField="creator"/>
<mx:DataGridColumn headerText="Publisher" dataField="publisher"/>
</mx:columns>
</mx:DataGrid>
</mx:Form>
</mx:Application>
Link:
http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/ae9bee8d-e2ac-43 c5-9b6d-c799d4abb2a3/
Thanks and Regards,
Vibhuti Gosavi | [email protected] | www.infocepts.com -
How to add new entry, in table on button click.
i have 2 input ,witch i am taking from numeric controls. this 2 input are use to calculat my output.
on button click i want these 4 things should go in the table.
now my problem is when i click the button previous entry in the table get lost...
plz help me to slove this problem.When you want to preserve the existing values in a table or array, you need to use "Array -> Build Array". Wire the local variable of the table or array to top entry, and wire your new entry to the bottom. Depends on the dimension of the array and the postion you want to add. You might need to some array manupilations. Try out some of the array VIs to see how they work.
Joe -
.click on row works with php table - does not work with javascript table.
Howdy,
I've run into a very interesting problem today, and I hope you'll be able to help me.
I have a page in which the top is php to read a table from the server, and post the table as the html page is being built.
The data come up as a table, and each row is clickable, that click moving the user to a different page, based on the row clicked.
Here are the relevant parts of the php code:
<?php
echo "<table id='patienttable' cellpadding=5px border=0 font-size=16px>";
echo "<tr><th width='30'>"."ID#"."</th><th width='100'>"."Last Name"."</th><th width='100'>"."First Name"."</th><th width='100'>".
"Middle Name"."</th><th width='80'>"."DOB"."</th><th width='50'>"."Zip"."</th><th width='50'>"."Gender"."</th><th width='100'>".
"Phone"."</th></tr>";
while ($row = mysqli_fetch_array($result))
blah blah blah
echo "<tr><td id='localid'>".$localid. "</td><td>".$lastname. "</td><td>".$firstname. "</td><td>".$middlename."</td><td>".$dob."</td><td>".$physzip. "</td><td>".$gender."</td><td>".$phone1. "</td></tr>";
echo "</table>";
?>
And here is the code to click on a row:
$("#patienttable tr").click(function() {
var passthis = $(this).find("#localid").html();
$.post("php/setsessionvariable.php",
{sessionval: passthis},
function(e) {window.location.href = "root.php"}
EVERYTHING works great - no problems - working now for about 2 months.
Today I started to build something similar, BUT! I cannot read from the database at the top of the page, I must do an ajax query, call the db, and post the data in a table;
Here is the boring, fairly straight-forward javascript code:
$.ajax({
type: "POST",
url: "findpatientbackend.php",
data: {letterslastname: lastname},
dataType : 'json',
success: function(result) {
$("#div1").html("");
if(result.length >= 1)
{var output = "";
$("div1").html("<table id='findtable'>");
$.each(result, function(index, value) {
output += "<tr><td width='100px'></td><td id='localid' width='100px'>"
+ value.localid + "</td><td width='100px'>"
+ value.lastname + "</td><td width='100px'>"
+ value.firstname + "</td><td width='100px'>"
+ value.middlename + "</td><td width='100px'>"
+ value.dob + "</td></tr>";
$("#div1").html(output);
$("div1").html("</table>");
error : function() { alert("error on return"); }
And here is the click row code, almost EXACTLY like the one above:
$("#findtable tr").click(function() {
var passthis = $(this).find("#localid").html();
$.post("php/setsessionvariable.php",
{sessionval: passthis},
function(e) {window.location.href = '../root.php'}
All the "stuff" loaded onto the page just fine, BUT, absolutely nothing happens when I click a row.
Playing around this afternoon, I did a "View Source" on both pages, and saw something VERY interesting;
1 - The table written by PHP is present, can be seen, and therefore is "clickable" to the jquery .click function.
2 - The table written by javascript is INVISIBLE! I cannot see it in the source view (but I can see it on the screen) and therefore the .click function can't see it either.
Questions:
1. How can I make the table written in javascript "clickable" - how can I make the javascript table "visible"?
2. Could it be the use of ".html" to post the table to the div? Is there another way?
And again, I thank you in advance for any help.I found the solution to my problem, and perhaps my comments here will help others.
Thinking a bit more, I wrote a separate javascript routine that created a table, allowed it to be styled, and allowed it to be clickable.
Here is the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js" type="text/javascript"></script>
<style>
#findtable {
width:200px;
background-color:#CFD3FE;
margin:10px auto;
text-align:center;}
</style>
<body>
<div id="puttablehere"></div>
<script>
$(document).ready(function () {
var output = "<table id='findtable'>";
for (var i = 0; i<15; i++) {output += "<tr><td width='100px'>X</td><td id='localid' width='100px'>X</td></tr>";}
output += "</table>";
$("#puttablehere").html(output);
$("#findtable tr").click(function(e) { alert("it works!"); });
</script>
</body>
</html>
The initial code I posted was creating the table the wrong way.
You have to create the WHOLE table at the same time, and post it all at once.
The code above does that.
My learning points are:
1. To create a table in javascript, and post it with a $("#puttablehere").html(output); call, you must put the ENTIRE table into that single string variable called "output" (or whatever you want to call it).
2. Everytime you call a jqeury .html function like this: ---("#puttablehere").html(output); -- It COMPLETELY over-writes the whole div/tr/td block that it is pointed at.
3. If you create a table in javascript (client side) you cannot see it with "View Source" - because what is posted in the table is AFTER the DOM is loaded.
Creating a table with php server side - you CAN see, because it is posted with the DOM.
So I thank you for your ideas, and I hope this may help another noob, such as myself, in the future.
Adios! -
How to code on button click how to increase row height in iphone/ios/uitableview
how to code on button click how to increase row height in iphone/ios/uitableview
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
pppp=[postText objectAtIndex:indexPath.row];
CGSize maxSize = CGSizeMake(280, MAXFLOAT);//set max height
CGSize cellSize = [pppp sizeWithFont:[UIFont systemFontOfSize:14]
constrainedToSize:maxSize
lineBreakMode:NSLineBreakByWordWrapping];//this will return correct height for text
// return cellSize.height+115;
BOOL isSelected = [self.selectedIndexPaths containsObject:indexPath];
CGFloat maxHeight = MAXFLOAT;
CGFloat minHeight = cellSize.height+115;
CGFloat constrainHeight = isSelected?maxHeight:minHeight;
CGFloat constrainWidth = tableView.frame.size.width - 20.0f;
NSString *text = hChildPost[indexPath.row];
CGSize constrainSize = CGSizeMake(constrainWidth, constrainHeight);
CGSize labelSize = [text sizeWithFont:[UIFont systemFontOfSize:15.0f]
constrainedToSize:constrainSize
lineBreakMode:NSLineBreakByCharWrapping];
// return MAX(labelSize.height+75, 100.0f); return MAX(labelSize.height+75,cellSize.height+115);
i used this code but it crashed appOn what line did it "crashed app" and what was the exception? The line within this function, not in main.m. If you haven't figured this out yet: view the debugger output, try single stepping, and/or add NSLog messages in the function.
-
Creating tables with a button click
can anyone give me a sample code for creating multiple tables in a scrollpane
with a button click.
ThanksHere is an example that returns a JTable in a JScrollPane in a JInternalFrame:
import java.awt.*;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import java.awt.GridLayout;
public class TablaJ extends JPanel{
public TablaJ(){
public TablaJ(String data[][], String columnNames[]){
super(new GridLayout(1,0));
final JTable table = new JTable(data, columnNames);
//Create the scroll pane and add the table to it.
JScrollPane scrollPane = new JScrollPane(table);
//Add the scroll pane to this panel.
add(scrollPane);
static JInternalFrame crearFrameConTabla(String data[][], String columnNames[], String tabla) {
//Create and set up the window.
JInternalFrame frame = new JInternalFrame(tabla,true,true,true,true);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
//Create and set up the content pane.
TablaJ newContentPane = new TablaJ(data, columnNames);
newContentPane.setOpaque(true); //content panes must be opaque
frame.setContentPane(newContentPane);
frame.pack();
return frame;
} -
Code for double clicking rows in alvgrido/p and moving it to internal tabl
hi,
code for double clicking rows in alvgrido/p and moving it to internal tablehi,
see the following code which uses layout , double_click event in ALVGRID.
TABLES: mara,marc.
DATA:obj_custom TYPE REF TO cl_gui_custom_container,
obj_alv TYPE REF TO cl_gui_alv_grid.
DATA: it_mara TYPE TABLE OF mara,
wa_mara TYPE mara,
wa_layout TYPE lvc_s_layo,
wa_variant TYPE disvariant,
x_save.
DATA:it_marc TYPE TABLE OF marc,
wa_marc TYPE marc.
SELECT-OPTIONS: s_matnr FOR mara-matnr DEFAULT 1 TO 500.
START-OF-SELECTION.
SELECT * FROM mara INTO TABLE it_mara
WHERE matnr IN s_matnr.
CALL SCREEN '100'.
CLASS cl_dbclick DEFINITION
CLASS cl_dbclick DEFINITION.
PUBLIC SECTION.
METHODS dbl FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row e_column.
ENDCLASS.
DATA: obj1 TYPE REF TO cl_dbclick.
CLASS cl_dbclick IMPLEMENTATION
CLASS cl_dbclick IMPLEMENTATION.
METHOD dbl.
IF e_row-rowtype = space AND NOT e_row-index IS INITIAL.
READ TABLE it_mara INDEX e_row-index INTO wa_mara.
SELECT * FROM marc INTO TABLE it_marc
WHERE matnr = wa_mara-matnr.
CALL METHOD obj_custom->free
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL SCREEN '200'.
ENDIF.
ENDMETHOD. "dbl
ENDCLASS. "cl_dbclick IMPLEMENTATION
*& Module USER_COMMAND_0100 INPUT
text
MODULE user_command_0100 INPUT.
CALL METHOD obj_custom->free
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module filldata OUTPUT
text
MODULE filldata OUTPUT.
CREATE OBJECT obj_custom
EXPORTING
container_name = 'CONTROL'.
CREATE OBJECT obj_alv
EXPORTING
i_parent = obj_custom.
CREATE OBJECT obj1.
SET HANDLER obj1->dbl FOR obj_alv.
CALL METHOD obj_alv->set_table_for_first_display
EXPORTING
i_buffer_active =
i_bypassing_buffer =
i_consistency_check =
i_structure_name = 'MARA'
is_variant = wa_variant
i_save = x_save
i_default = 'X'
is_layout = wa_layout
is_print =
it_special_groups =
it_toolbar_excluding =
it_hyperlink =
it_alv_graphics =
it_except_qinfo =
ir_salv_adapter =
CHANGING
it_outtab = it_mara
it_fieldcatalog =
it_sort =
it_filter =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
others = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDMODULE. " filldata OUTPUT
*& Module STATUS_0100 OUTPUT
text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module STATUS_0200 OUTPUT
text
MODULE status_0200 OUTPUT.
SET PF-STATUS 'STATUS'.
* SET TITLEBAR 'xxx'.
SUPPRESS DIALOG.
SET PARAMETER ID 'MAT' FIELD wa_mara-matnr.
LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
*WRITE:/ wa_mara-matnr,
wa_mara-mbrsh,
wa_mara-meins.
CREATE OBJECT obj_custom
EXPORTING
container_name = 'CONTROL'.
CREATE OBJECT obj_alv
EXPORTING
i_parent = obj_custom.
CALL METHOD obj_alv->set_table_for_first_display
EXPORTING
i_buffer_active =
i_bypassing_buffer =
i_consistency_check =
i_structure_name = 'MARC'
is_variant = wa_variant
i_save = x_save
i_default = 'X'
is_layout = wa_layout
is_print =
it_special_groups =
it_toolbar_excluding =
it_hyperlink =
it_alv_graphics =
it_except_qinfo =
ir_salv_adapter =
CHANGING
it_outtab = it_marc
it_fieldcatalog =
it_sort =
it_filter =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
others = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDMODULE. " STATUS_0200 OUTPUT
*& Module layout OUTPUT
text
MODULE layout OUTPUT.
wa_layout-grid_title = 'MATERIAL DATA'.
wa_layout-zebra = 'X'.
wa_layout-edit = 'X'.
ENDMODULE. " layout OUTPUT
*& Module variant OUTPUT
text
MODULE variant OUTPUT.
wa_variant-report = 'ZALV_GRID1'.
x_save = 'A'.
ENDMODULE. " variant OUTPUT
*& Module USER_COMMAND_0200 INPUT
text
MODULE user_command_0200 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
CALL METHOD obj_custom->free
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LEAVE TO SCREEN '100'.
ENDCASE.
ENDMODULE. " USER_COMMAND_0200 INPUT
thanks,
raji
reward if helpful -
Sum of Values from previous rows in a dynamic table
Hello,
I have a dynamic table has multiple rows (added dynamically via a button). One column in the table is a Quantity column. Another is a Total column. We do not want to keep a running total, but only wish to display a total when the rest of the cells in that row are emty and the previous row(s) has/have values in the Quantity column. The Total is the sum on the Quatnities up to a blank row. Below is a sample. How do I get teh value of the Quantities in the previous rows?
Quantity
Total
5
8
12
25
7
27
34
22
22
Another option might be to put the Total in the last row with data as opposed to the row below the data.
Any ideas?
Regards,
KarlThe script is written to achive your requirement (i.e. the second approach you have mentioned)
You can either contact me at [email protected] to get the sample form created.
Or the following is the XML Source of the form. Copy the entire content in XML source view of your form and see the result.
<?xml version="1.0" encoding="UTF-8"?>
<?xfa generator="AdobeLiveCycleDesignerES_V9.0.0.0.20091029.1.612548" APIVersion="3.1.9277.0"?>
<xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/" timeStamp="2012-02-28T14:04:54Z" uuid="2c561cdf-3377-4e84-9a89-51e740bb2fea">
<template xmlns="http://www.xfa.org/schema/xfa-template/2.8/">
<?formServer defaultPDFRenderFormat acrobat9.0dynamic?>
<subform name="form1" layout="tb" locale="en_US" restoreState="auto">
<pageSet>
<pageArea name="Page1" id="Page1">
<contentArea x="0.25in" y="0.25in" w="197.3mm" h="284.3mm"/>
<medium stock="a4" short="210mm" long="297mm"/>
<?templateDesigner expand 1?></pageArea>
<?templateDesigner expand 1?></pageSet>
<subform w="197.3mm" layout="tb">
<subform name="Subform1" w="190.5mm" h="25.4mm">
<field name="Button1" y="15.875mm" x="60.325mm" w="28.575mm" h="6mm">
<ui>
<button highlight="inverted"/>
</ui>
<font typeface="Myriad Pro"/>
<caption>
<value>
<text>Add Row</text>
</value>
<para vAlign="middle" hAlign="center"/>
</caption>
<border hand="right">
<?templateDesigner StyleID apbx2?>
<edge stroke="raised"/>
<fill/>
</border>
<bind match="none"/>
<event activity="click" name="event__click">
<script contentType="application/x-javascript">
try
Subform2.Table1._Row1.addInstance(1);
//for(var i=0;i<Subform2.Table1._Row1.count;i++)
//xfa.resolveNode("Subform2.Table1.Row1["+i+"].Total").execEvent("exit");
}catch(e)
app.alert(e)
</script>
</event>
</field>
<?templateDesigner expand 1?></subform>
<subform name="Subform2" w="196.85mm">
<subform name="Table1" layout="table" columnWidths="55.916mm 44.47mm" x="38.1mm" y="12.7mm">
<border>
<edge/>
</border>
<subform layout="row" name="HeaderRow" id="HeaderRow_ID">
<assist role="TH"/>
<draw h="10mm" name="Cell1">
<border>
<edge/>
<corner thickness="0.1778mm"/>
</border>
<ui>
<textEdit/>
</ui>
<value>
<text>Quantity</text>
</value>
<font typeface="Myriad Pro"/>
<margin topInset="0.5mm" bottomInset="0.5mm" leftInset="0.5mm" rightInset="0.5mm"/>
<para vAlign="middle" hAlign="center"/>
</draw>
<draw h="10mm" name="Cell2">
<border>
<edge/>
<corner thickness="0.1778mm"/>
</border>
<ui>
<textEdit/>
</ui>
<value>
<text>Total</text>
</value>
<font typeface="Myriad Pro"/>
<margin topInset="0.5mm" bottomInset="0.5mm" leftInset="0.5mm" rightInset="0.5mm"/>
<para vAlign="middle" hAlign="center"/>
</draw>
<border>
<edge presence="hidden"/>
</border>
<occur max="-1"/>
<?templateDesigner expand 1?></subform>
<subform layout="row" name="Row1">
<assist role="TR"/>
<field name="Quantity" w="55.916mm" h="9.317mm">
<ui>
<numericEdit>
<border presence="hidden">
<?templateDesigner StyleID aped0?></border>
<margin/>
</numericEdit>
</ui
><
font typeface="Myriad Pro"/><
margin topInset="1mm" bottomInset="1mm" leftInset="1mm" rightInset="1mm"/><
para vAlign="middle"/><
border><
edge/><
corner thickness="0.1778mm"/></
border></
field><
field name="Total" w="44.47mm" h="9.317mm" access="readOnly"><
ui><
numericEdit><
border presence="hidden">
<?templateDesigner StyleID aped0?>
</border><
margin/></
numericEdit></
ui><
font typeface="Myriad Pro"/><
margin topInset="1mm" bottomInset="1mm" leftInset="1mm" rightInset="1mm"/><para vAlign="middle"/>
<border>
<edge/>
<corner thickness="0.1778mm"/>
</border>
<calculate>
<script contentType="application/x-javascript">
try
var nextRow = xfa.resolveNode("Subform2.Table1.Row1["+(this.parent.instanceIndex+1)+"]"); // Next row of the table
if((nextRow==null || nextRow.Quantity.rawValue == null || nextRow.Quantity.rawValue=="") && Quantity.rawValue!=null) // If there is no more rows OR the next row don't contain any Quantity value
var subTotal = 0;
for(var j=this.parent.instanceIndex;j>=0;j--) // Loop until the previous row has empty value OR reach start of row Index (i.e. 0)
var prevObj = xfa.resolveNode("Subform2.Table1.Row1["+j+"].Quantity"); // locate the previous row's Quantity object
if(prevObj.rawValue == null || prevObj.rawValue=="")
break; // if blank value found, skip the loop
subTotal+= prevObj.rawValue;
this.rawValue = subTotal; // Update the Total value
}else
this.rawValue = null; // Clear the total value
}catch(e)
app.alert(e)
</script>
</calculate>
</field>
<border>
<edge presence="hidden"/>
</border>
<occur max="-1"/>
<?templateDesigner expand 1?></subform>
<keep intact="contentArea"/>
<?templateDesigner rowpattern first:1, next:1, firstcolor:f0f0f0, nextcolor:ffffff, apply:0?>
<overflow leader="HeaderRow"/>
<?templateDesigner expand 1?></subform>
<?templateDesigner expand 1?></subform>
<?templateDesigner expand 1?></subform>
<proto/>
<desc>
<text name="version">9.0.0.0.20091029.1.612548.606130</text>
</desc>
<?templateDesigner expand 1?></subform>
<?templateDesigner DefaultPreviewDynamic 1?>
<?templateDesigner DefaultRunAt client?>
<?templateDesigner Grid show:1, snap:1, units:0, color:ff8080, origin:(0,0), interval:(125000,125000)?>
<?templateDesigner FormTargetVersion 28?>
<?templateDesigner DefaultLanguage JavaScript?>
<?acrobat JavaScript strictScoping?>
<?templateDesigner Zoom 62?>
<?templateDesigner Rulers horizontal:1, vertical:1, guidelines:1, crosshairs:0?>
<?templateDesigner SaveTaggedPDF 1?>
<?templateDesigner SavePDFWithEmbeddedFonts 1?></template>
<config xmlns="http://www.xfa.org/schema/xci/2.8/">
<agent name="designer">
<!-- [0..n] -->
<destination>pdf</destination>
<pdf>
<!-- [0..n] -->
<fontInfo/>
</pdf>
</agent>
<present>
<!-- [0..n] -->
<pdf>
<!-- [0..n] -->
<fontInfo/>
<version>1.7</version>
<adobeExtensionLevel>3</adobeExtensionLevel>
</pdf>
<xdp>
<packets>*</packets>
</xdp>
</present>
</config>
<localeSet xmlns="http://www.xfa.org/schema/xfa-locale-set/2.7/">
<locale name="en_US" desc="English (United States)">
<calendarSymbols name="gregorian">
<monthNames>
<month>January</month>
<month>February</month>
<month>March</month>
<month>April</month>
<month>May</month>
<month>June</month>
<month>July</month>
<month>August</month>
<month>September</month>
<month>October</month>
<month>November</month>
<month>December</month>
</monthNames>
<monthNames abbr="1">
<month>Jan</month>
<month>Feb</month>
<month>Mar</month>
<month>Apr</month>
<month>May</month>
<month>Jun</month>
<month>Jul</month>
<month>Aug</month>
<month>Sep</month>
<month>Oct</month>
<month>Nov</month>
<month>Dec</month>
</monthNames>
<dayNames>
<day>Sunday</day>
<day>Monday</day>
<day>Tuesday</day>
<day>Wednesday</day>
<day>Thursday</day>
<day>Friday</day>
<day>Saturday</day>
</dayNames>
<dayNames abbr="1">
<day>Sun</day>
<day>Mon</day>
<day>Tue</day>
<day>Wed</day>
<day>Thu</day>
<day>Fri</day>
<day>Sat</day>
</dayNames>
<meridiemNames>
<meridiem>AM</meridiem>
<meridiem>PM</meridiem>
</meridiemNames>
<eraNames>
<era>BC</era>
<era>AD</era>
</eraNames>
</calendarSymbols>
<datePatterns>
<datePattern name="full">EEEE, MMMM D, YYYY</datePattern>
<datePattern name="long">MMMM D, YYYY</datePattern>
<datePattern name="med">MMM D, YYYY</datePattern>
<datePattern name="short">M/D/YY</datePattern>
</datePatterns>
<timePatterns>
<timePattern name="full">h:MM:SS A Z</timePattern>
<timePattern name="long">h:MM:SS A Z</timePattern>
<timePattern name="med">h:MM:SS A</timePattern>
<timePattern name="short">h:MM A</timePattern>
</timePatterns>
<dateTimeSymbols>GyMdkHmsSEDFwWahKzZ</dateTimeSymbols>
<numberPatterns>
<numberPattern name="numeric">z,zz9.zzz</numberPattern>
<numberPattern name="currency">$z,zz9.99|($z,zz9.99)</numberPattern>
<numberPattern name="percent">z,zz9%</numberPattern>
</numberPatterns>
<numberSymbols>
<numberSymbol name="decimal">.</numberSymbol>
<numberSymbol name="grouping">,</numberSymbol>
<numberSymbol name="percent">%</numberSymbol>
<numberSymbol name="minus">-</numberSymbol>
<numberSymbol name="zero">0</numberSymbol>
</numberSymbols>
<currencySymbols>
<currencySymbol name="symbol">$</currencySymbol>
<currencySymbol name="isoname">USD</currencySymbol>
<currencySymbol name="decimal">.</currencySymbol>
</currencySymbols>
<typefaces>
<typeface name="Myriad Pro"/>
<typeface name="Minion Pro"/>
<typeface name="Courier Std"/>
<typeface name="Adobe Pi Std"/>
<typeface name="Adobe Hebrew"/>
<typeface name="Adobe Arabic"/>
<typeface name="Adobe Thai"/>
<typeface name="Kozuka Gothic Pro-VI M"/>
<typeface name="Kozuka Mincho Pro-VI R"/>
<typeface name="Adobe Ming Std L"/>
<typeface name="Adobe Song Std L"/>
<typeface name="Adobe Myungjo Std M"/>
</typefaces>
</locale>
</localeSet>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 4.2.1-c043 52.398682, 2009/08/10-13:00:47 ">
<
rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><
rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about=""><
xmp:MetadataDate>2012-02-28T14:04:54Z</xmp:MetadataDate><
xmp:CreatorTool>Adobe LiveCycle Designer ES 9.0</xmp:CreatorTool></
rdf:Description><
rdf:Description xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about=""><
pdf:Producer>Adobe LiveCycle Designer ES 9.0</pdf:Producer></
rdf:Description><
rdf:Description xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/" rdf:about=""><
xmpMM:DocumentID>uuid:2c561cdf-3377-4e84-9a89-51e740bb2fea</xmpMM:DocumentID></
rdf:Description><
rdf:Description xmlns:desc="http://ns.adobe.com/xfa/promoted-desc/" rdf:about=""><
desc:version rdf:parseType="Resource"><
rdf:value>9.0.0.0.20091029.1.612548.606130</rdf:value><
desc:ref>/template/subform[1]</desc:ref></
desc:version></
rdf:Description></
rdf:RDF></
x:xmpmeta></xdp:xdp> -
How to get the number of rows in a HTML table in some other page
Hi,
I am incrementing HTML table rows on button click and saving number of rows in a javascript variable. But on submitting that page I need that number of row value in the following page
example:
HTML table is in the page first.jsp
and the javascript variable having the current row number is row_number
on submitting it goes to second.jsp page. There i need that row_number value.
Can anyone help me to solve this?
regards,
carryfunction buttonClick()
var table = profileTable;
var lnRow = table.rows.length;
var insertedRow = table.insertRow(parseFloat(lnRow));
var cell1 = insertedRow.insertCell();
cell1.innerHTML ="<tr><td><Input type=\"hidden\" >>>name=\"rowNum\" value="+cnt"+></td></tr>";
document.profileform.submit;
on submit it goes to the second page, but the value i got using >>>System.out.println("row number from text >>>box"+request.getParameter("rowNum")); is null. What is wrong with >>>my coding. Can anyone solve this.HI carry
Check the value of bold data
function buttonClick()
var table = profileTable;
var lnRow = table.rows.length;
var insertedRow = table.insertRow(parseFloat(lnRow));var cnt=inRow
var cell1 = insertedRow.insertCell();
cell1.innerHTML ="<tr><td><Input type=\"hidden\" >>>name=\"rowNum\" value="+cnt+"></td></tr>";
document.profileform.submit;
}try with it -
Deleting a row from the item table
Hi All,
I have a requirement where I need to put a button to delete the selected row from the item table and for this I have written the following code:
DATA lo_nd_t_bseg TYPE REF TO if_wd_context_node.
DATA lo_el_t_bseg TYPE REF TO if_wd_context_element.
DATA ls_t_bseg TYPE wd_this->element_t_bseg.
data: it_tab type table of wd_this->element_t_bseg.
lo_nd_t_bseg = wd_context->path_get_node( path = `Z.T_BSEG` ).
lo_el_t_bseg = lo_nd_t_bseg->get_element( ).
lo_el_t_bseg->get_static_attributes(
IMPORTING
static_attributes = ls_t_bseg ).
lo_nd_t_bseg = wd_context->path_get_node( path = `Z.T_BSEG` ).
lo_el_t_bseg = lo_nd_t_bseg->get_element( ).
IF lo_el_t_bseg IS not INITIAL.
lo_nd_t_bseg->remove_element( lo_el_t_bseg ).
ENDIF.
Now the problem is although it's deleteing the selected line correctly but because of this I am losing one line on the screen for the user to enter... my form has a fixed number of lines and in my case it's 10... so everytime I am using deleting a line item I am losing one line to enter..... can you please tell me how can I avoid this?
Edited by: rajatg on Aug 4, 2011 3:12 PMlets say...
i have 1,2,3 documents
i have cleared , document 2....
1. when the user selects this record.... you can read the context_element....using the context element you can get the values and clear those values and set the blank values...
when the user click on save ...you can have only those two records in the table.
2. conitnue with your logic .... remove_element. once it is done ,,, create_element at the deleted index...
3. when clicked on delete ...remove_element ( current code).... bind the table to the node... and you will have ur values
Maybe you are looking for
-
Add a new field to existing Table
Hi , We want to add a new field to existing table from ECC and populate historical data . We have already extracted data from ECC to VBAK Table . We have to add a new field - Incoterms in HANA . This field exists in ECC . Please guide.
-
Right now I have an iBook G4, but next month when leopard comes out I am thinking about upgrading to the macBook Pro. I want to use my 23 inch LCD tv as an external monitor, and I am wonderring what the best way to do this would be. I am planning on
-
Day 1 Big problem. Registered my new i oad on i tunes. I Live and bank in Spain which is all ok until I want to look on apps......its all in spanish and changibg the kanguage does noit work HELP
-
Running oracle report created by xml
I would like to create the oracle report using xml file in runtime. Based on the note a92102.pdf,I able to create the xml file. But I have no idea how to run these file? How can I test it? Hope somebody can give suggestion? thanks.
-
Question on External Authentication Plug-in
I have 2 windows domains with no global catalog server. The documentation shows how to setup external authentication plug-in when you have just one domain. Can anyone provide a link on how to setup the plug-in when you have more than one domain? Than