Dynamic row in STRUTS2

dear java,
Help needed for updating an list in jsp with values added as dynamic row in STRUTS2.
I have a table displaying data from list (<s:iterator>). It displays 2 rows. I have a button which on clicks added one more row.. blank row (consists, textfields).. in which data is added. now on submit, i need to update list.
Any help would be much appreciated!

tnx friend.,
anyway i got the result.
instead of using <s:textfield name="textFields[0]" />, i have replaced for (within JS method)
<input type='text' name='locationId[" + num + "]' value='' id='dyamicRowAction_locationId_" + num + "_'/>
(its actual replacement html tag for S2 tag - get it from view source ).

Similar Messages

  • Dynamic Rows in Report Painter

    Hello everyone,
    I'm new to report painter and m using the SAP Library help  material to understand report painter. I've one query though i.e
    Is it possible to create a report hrough report painter with dynamic rows ? if yes then pls let me know how.
    Regards
    Anik

    Thank you.
    See I have the below Rows
    Total Revenue
    Cost2
    Cost3
    Direct Cost
    Gross = Total revenue - Direct Cost
    Gross % = (Gross/Total revenue ) * 100
    I have Columns as with basic Key figures and Formulas
    Year(basic key Figure)
    Year+1(basic key Figure)
    Total = Year + (Year+1)
    Its giving me correct values in case of Basic Key figures and not in the formula case.
    It giving error when there is formula both in Row and Column.
    In the above case last row and last colum. Only Column formula is getting implemented.
    Here for example I have mentioned 4 rows and 4 columns.. But I have 15 Rows and 30 columns .. out of which 15 rows and columns have formulas...
    % Rows are problem.. which gives me errors... I tried using Special cells, but I am not 100% sure how to use them.
    I would be very thankful if you can help me out.. Please

  • How do I set the value of a dynamic row text field

    I have a repeated row form which contains a button and multiple text fields.  There is a text field (Input Data Field) further up with some information I want to place in the table and multiple buttons that I want to read the value of and set to the table.  I apologize there are multiple questions I have and I am using pseudocode to describe it.
    Top form looks like
    InputField
    | ButtonX1 | ButtonY1 | DescriptionX1 (read only Text Field)
    | ButtonXn | ButtonY1 | DescriptionXn
    OutputRow looks like
    | ButtonOutput | OutputField1 | OutputField2 | OutputField3 |
    So I would like it to do
    ButtonX1.click
    OutputTable.OutputRow.addInstance(true)  //this works - everything else I have questions on
    OutputTable.OutputRow.OutputField1.rawValue = DescriptionX1.rawValue
    Question 1
    How do I address the location in each table to set a value
    Question 2
    How do I get the value of the description field in the same table and row as the button
    I would like to say something to the effect of  OutputTable.OutputRow[??].OutputField1.rawValue = this.parent.DescriptionX
    OutputTable.OutputRow.OutputField2 = InputField.rawValue
      Same question as above - how do I specify a dynamic row - is this the proper syntax for getting the value from the input field?
    OutputTable.OutputRow.OutputField3 = this.ButtonLabel
    Question 3
      How can I get the value of the button's label to set in the field
      There should be very many of these buttons and buttons will be added - I would prefer to set the value based on the button's label to make the value easier - not requiring changing the code
    Question 4 - unrelated to those above.
    Is it possible to build the first table
    | ButtonX | ButtonY | Description |
    from an XML File.  I have seen examples of how to build if it is just data, but can the XML be pushed into a form with code to do the above actions?

    Each object in a form must have a unique name. I doing so it is not neccessarily the name but the path or SomExpression associated with that object that must be unique. In your case you have a Table.Row.object configuration. The Row is the part that is repeating so to give each object a unique name an instance number is placed on the repeating part. So objects in the 1st row woudl be Table.Row[0].object...objects in the second row woudl be Table.Row[1].object etc .....You can see this by adding a debug instruction on the Enter event of the description field. Put the code app.alert(this.somExpression) and when you enter the field you will see what the somExpression is. Do this for a few rows and you will see the pattern (don't forget to remove the debug code from the enter event). Now you know what you have to use to address the fields. If no instance is given it is assumed to be 0 ..that is why only the 1st row is being affected.
    So now to answer your questions:
    Question1: The square bracket notation is an issue for javascript (this is the notation for an array) so we have to use a different means of addressing the field to include the instance number. So to address the Description in the 3rd row we woudl use:
    xfa.resolveNode("Table.Row[2].Description").rawValue = "This is my new description";
    Note that the instance number is 2 for the 3rd row because the instance numbers are 0 based.
    Question2. The resolveNode notation allows you to pass a string so you can also concatinate expressions to make the string. If you are writing code on a button in the same row you can get the instance that you are on by using the expression this.parent.index. The "this" portion refers to the current object (the button) and the parent.index gets you th eindex of the Buttons parent. If the button is embedded deeper in a hierarchy then you can continue to add parent indicators until you get back to the node that you want. So rewriting your expression from Q1 it woudl be:
    xfa.resolveNode("Table.Row[" + this.parent.index + "].Description").rawValue = "This is my new description";
    Question3: The buttons caption can be retrieved by using ButtonName.caption.value.text.value
    Question4: When you say build from an XML file. What are you expecting to come from the XML file? The caption that goes on the button? Typically the XML file carries data (not to say that it cannot carry other things). Just need a bit of clarification on this one first.
    Hope that helps
    Paul

  • Error while saving dynamic row values of datagrid with record.

    hi friends,
    i am trying to add dynamic row in datagrid and save that value with record.i succeeded in first part while i am saving the record the error show like this.
    errro:Property fromAmount not found on com.ci.view.Task and there is no default value.
    how i resolve this error.
    any suggession welcom
    thanks in advance.
    B.venkatesan
    code:
    package:
    package com.ci.view
        [Bindable]
        public class Task
            public function Task(frmAmount:String,toAmount:String,commissionPercentage:String)
                this.frmAmount=frmAmount;
                this.toAmount=toAmount;
                this.commissionPercentage=commissionPercentage;
            public var frmAmount:String;
            public var toAmount:String;
            public var commissionPercentage:String;
    main mxml:
    [Bindable]
                private var tasks:ArrayCollection;
                private static const ADD_TASK:String= "";
                private function init():void
                    tasks = new ArrayCollection();
                    tasks.addItem(new Task("0","1000","0"));
                    tasks.addItem({frmAmount:ADD_TASK});
                private function checkEdit(e:DataGridEvent):void
                    // Do not allow editing of Add Task row except for
                    // "Click to Add" column
                    if(e.rowIndex == tasks.length - 1 && e.columnIndex != 0)
                        e.preventDefault();
                private function editEnd(e:DataGridEvent):void
                    // Adding a new task
                    if(e.rowIndex == tasks.length - 1)
                        var txtIn:TextInput =TextInput(e.currentTarget.itemEditorInstance);
                        var txtIn1:TextInput =TextInput(e.currentTarget.itemEditorInstance);
                        var txtIn2:TextInput =TextInput(e.currentTarget.itemEditorInstance);
                        var dt:Object = e.itemRenderer.data;
                        // Add new task
                        if((txtIn.text) != ADD_TASK)
                            var x:String=String(txtIn.text);
                            tasks.addItemAt(new Task("", "", ""), e.rowIndex);
                        // Destroy item editor
                        commPlanDetGrid.destroyItemEditor();
                        // Stop default behavior
                        e.preventDefault();

    Venktesan,
    You are trying compare String and int..! which is not possible try to case the txtIn.text to int using parseInt(txtIn.text).
    ORIGINAL:
    if(txtIn.text != ADD_TASK).---->error : Comparison between a value with static type String and a possibly unrelated type int
                        tasks.addItemAt(new Task(txtIn.text, 0, ""), e.rowIndex);----> error:Implicit coercion of a value of type String to an unrelated type int.
    EDITED:
    if(parseInt(txtIn.text) != ADD_TASK).---->error : Comparison between a value with static type String and a possibly unrelated type int
                        tasks.addItemAt(new Task(parseInt(txtIn.text), 0, ""), e.rowIndex);----> error:Implicit coercion of a value of type String to an unrelated type int.
    Thanks
    Pradeep

  • Dynamic rows in Table Control

    Hi Experts,
    My Requirement is create a table control with 5 coloumns. The rows have to be displayed dynamically...
    I created a screen , and placed a table control.
    For eg :
       if my internal table having 2 entries , then the table control should only have two rows....(no disable/greyout)
       if internal table having say 40 entries , then the table control should have 40 rows...
    Thanks,
    Lakshmiraj.A

    Hi,
    Refer
    table control dynamic rows
    Dynamic rows increment according to user input in Table Control Module Pool
    Hope this helps
    Sumana

  • How to set boundry value in dynamic rows in datagrid

    hi friends,
    I am new to flex.i want to add dynamic rows to datagrid that means.once i enter the first record i want to press tab button then it will automatically  go to the second row.and update the record continuously.once it reach the maximum value means the next row will not be edit.
    mxkimum value =10000
    from value            to value        percentage
    0.01                        2000             10
    2000                         8000           20
    8000                        10000               30
    after it reach 10000 next row will not edit,this is i want how i do this please help.
    If any suggession tel
    thanks
    B.venkatesan

    Hi,
    As Armin said use the following:
    wdContext.nodeXXX().currentXXXElement().setAttributeValue("attributeName", value)
    Here you give the value as value of simpleType and not its description.
    thanks & regards,
    Manoj

  • I need to add the Dynamic rows in the Jform

    {color:#800000}*I have used Jform in the net beans... when the submit button i clicked then the dynamic rows should be inserted.. how can do that... i have used DefaulttableModel but in netbeasns it is not supporting i dont know how to add please tell me where i have to add the changes*{color}

    vidhyaprakash wrote:
    I have used Jform in the net beans... What is a Jform?
    when the submit button i clicked then the dynamic rows should be inserted.. Is this Swing coding? When I think of submit buttons, I usually think of Java Server Pages.
    In other words, if possible, please clarify your question as details matter here. Also, showing the code you've tried would help too.
    Good luck.

  • Dynamic Row Suppression based on grid POV

    Hi,
    I need to suppress rows based on the grid POV. The report is set up to have accounts in the rows and the user is able to select a specific account in the grid POV. Based on the grid selection, half of the accounts in the rows either need to be suppressed or not.
    One solution already available is to use advanced suppression on each row but this option will take too long. I'd like to find a solution using UDA's or some other way. Any ideas?

    Im not sure there is any simple way to get dynamic row selection based on what is selected in the page.
    If I were designing the form based on what you have stated, I would probably stick both Account and Year in the page, and the 400 products in rows. This would require the user to select the different combinations of Year / Account, but would mean only 12 columns (instead of 72).
    Alternatively you could stick Account in rows too - meaning 800 rows, but less combinations to select in Page....all depends what is deemed acceptable to the user.
    Probably other approaches that may be better than above (put Product in the Page for fun!!)
    Thanks
    JB

  • Dynamic row additon in Interactive Offline Adobe Form

    Hi ,
    I have to add some dynamic row based on some condition in Adobe Form .Please let me know.
    Ricky

    Hi Ricky,
    You need multiple rows for a dynamic structure field of a data source.
    Just do data binding to the table.
    In row-->binding tab select check box "Repeat Row for each Data Item".
    Leave the min value as 1 you can specify the max value if do want to restrict.
    If you need to have a row added dynamically via code, you can do so by using table.row.instancemanger.addinstance
    Regards,
    Sai

  • Dynamic row selection based on Page member selection in Planning web-form

    Hello experts
    I have requirement where, user dont want 10 webforms to enter 2 accounts line for various sparse members. Below is the dimension detail and web-form current design
    Account - Dense
    Period - Dense
    Year - Sparse
    Scenario - Sparse
    Version - Sparse
    Entity - Sparse
    Product - Sparse (600 level 0 members)
    Product dim has family1 as parent and 40 level 0 mem like that there are 10 family level 1 members, now to enter account member (only 2 member) for 6 years projection ( it means 12 periods and 6 years in column ) , i can build 10 web-forms with one web-form has one family level-0 mem in rows,
    however my question, is how can i achieve this in one web-form, instead of 10 web-forms for 400 products ?
    your help is greatly appreciated.
    Edited by: 859874 on Jul 18, 2012 8:58 PM

    Im not sure there is any simple way to get dynamic row selection based on what is selected in the page.
    If I were designing the form based on what you have stated, I would probably stick both Account and Year in the page, and the 400 products in rows. This would require the user to select the different combinations of Year / Account, but would mean only 12 columns (instead of 72).
    Alternatively you could stick Account in rows too - meaning 800 rows, but less combinations to select in Page....all depends what is deemed acceptable to the user.
    Probably other approaches that may be better than above (put Product in the Page for fun!!)
    Thanks
    JB

  • Read mutliple dynamic rows of a Table in Adobe Form into GP's context

    Hello All,
    I have a GP scenario where in user inputs multiple rows of data in a table which is on an Interactive Adobe Form.
    I want to read those values entered dynamically and passed between callable objects.
    Please could you suggest on this? If you post any sample code that would be of great help.
    Best Regards,
    Suyukti B N

    Hi Tamas,
    I checked the mentioned form and, as this table is setted as TABLEROW and some of its cells are static, is not possible to change the column size in the layout or even though changing it directly in the XML file, cell by cell. I was trying it.
    For example, choose the Cell6 of TABLEROW[0] and click on tab 'XML Source'. You will see this statement:
    <draw colSpan="3" h="16.3166mm" name="Cell7" w="22.225mm">
    You can try to change the value 'colSpan' according to your requirement.
    This table size is not modifiable because it was developed to it.
    I believe that Diego's suggestion can help in this case, if you are having problems to print the entire table on the page.
    Regards,
    Lucas Comassetto.

  • How to display data in table with dynamic rows, section wise in a page.

    Hello all,
    I work on report creation in BI Publisher where I need to display data from xml in a table in pdf format.The output page is divided into two vertical sections , containing tables, with exactly same columns on left and right sections. The number of rows in table depends on the output of the fetching query. The page is to be populated in such a way that, at first, the left table is populated, then the next rows fill up the table on the right section of the page, if more rows are left, they fill up the tables on next page[first the left table, and then the right one, in a similar fashion as in page 1]
    On a bird's eye view, the data needs to be simply mapped to a table, with dynamic number of rows, and so can span number of pages depending on size of data. On a implementation level, I am stuck in getting the left section of the page populated first, then the right section[in place of the right page], and then the next page.
    Please guide me if someone has any idea in getting this achieved.
    Thanks in advance.

    Thanks for the response...
    I am able to get the desired functionality. I just need the tables to be inside a bigger table, that also has a dividing line between the two columns. This is was is intended in the req. provided to me. The column formatting option provides me a line ,but that is not further modifiable .Please help me in getting a perpendicular line between the two columns, which I need to be of a specified width and color.

  • Dynamic rows in tables, second line values are duplicated on every lines

    Hello,
    I am building an offline form interfaced with an abap program.
    The abap program is sending a table define like this :
    material  |  batch  | quantity   | unit
    I add javascript in the form in order to add dynamically new rows to this table :
    button ADD :
    TABLE.LINE.instanceManager.addInstance(1);
    //Invoke the recalculate method to include the field values from the added row in calculations.
    xfa.form.recalculate(1);
    button DELETE :
    xfa.form.data.MAIN.table.TABLE._line.removeInstance(this.parent.index);
    // Invoke the recalculate method to update the form calculations.
    xfa.form.recalculate(1);
    My problem is that the data table only have two line, and even if I add new line, the second line values are copied to the next ones...
    Table is well defined as 1 to n..
    Thank you for your help.

    Hello Mr.Louis,
    I'm having a similiar problem.
    I'm using LCDsgn 8.0/Adobe Reader 8.1 and OS is MS Windows XP Proff 2002.
    My Internal Table EMPNO ///  Name  /// City.
    In my case there is no duplication. But, when I add row,
    1. the empty row get added.
    2. I do the entry in Name and City fields and go for addition of another new row.
    3. It adds a new row, but  clears name and city of the previously added row.
    4. When I add a new row again, and enter all values then it modifes with correct value for the row effected in step 3. But entry for new row added get similarly erased.
    Any insight towards the resolution of this would be highly appreciated.
    Regds,
    Srinivasan.

  • Dynamic rows in ABAP webdynpro table

    hi all
    I've got a question. I have a webdynpro with a table.
    This table is feed by a node. The number of rows of this node is dynamic.
    I had seen in the properties of the table object that the number of visible rows can be set.
    But is there also a method to set this number of rows dynamicly? So when the node has 20 rows
    the table object is also set to show 20 rows and when there are none, the table
    only shows the header of the  table.
    Currently the table always shows 5 rows, without checking how many rows there actually are.
    Does any of you know how to do this?
    kind regards,
    Anton Pierhagen

    Hi Anton ,
    You can use the method SET_VISIBLE_ROW_COUNT() of the class cl_wd_table for setting the visible row count dynamically.
    In the WDDOMODIFY view , you can get the reference of the table UI element used and proceed.
    DATA lo_table TYPE cl_wd_table.
    lo_table ?= view->get_element( ID = 'name_of_table_in_the_view').
    lo_table->SET_VISIBLE_ROW_COUNT(value = 5)."Here the value you can decide based on your data.
    But this method is not recommended as it directly deals with the view's elements and will be very difficult for the person maintaining the code.
    Instead create a attribute which can store a number and bind the visible row count property to this attribute.
    set this attribute with the values based on the data.(as in number of visible rows you would want to see.)
    Thanks,
    Aditya

  • Dynamic row in alv.

    i wont to now if i can do it in alv that the row change dynamicly for largest word in the row in the column. thankes.

    hi,
    just try in the layout.
    *&      Form  BUILD_LAYOUT
          Build layout for ALV grid report
    form build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
    gd_layout-totals_only        = 'X'.
    gd_layout-f2code            = 'DISP'.  "Sets fcode for when double
                                            "click(press f2)
    gd_layout-zebra             = 'X'.
    gd_layout-group_change_edit = 'X'.
    gd_layout-header_text       = 'helllllo'.
    endform.                    " BUILD_LAYOUT
    rgds
    anver

Maybe you are looking for