Reset the iterator binding

Hello

I displays a table based on an iterator binding executable. I click on a line, then a button located outside the table that positions the iterator at the end, add a new line and go to a new fragment:

    private void createRow(String iteratorName) {
        DCIteratorBinding binding = ADFUtils.findIterator(iteratorName);
        //access the underlying RowSetIterator
        RowSetIterator rsi = binding.getRowSetIterator();
        //get handle to the last row
        Row lastRow = rsi.last();
        //obtain the index of the last row
        int lastRowIndex = rsi.getRangeIndexOf(lastRow);
        //create a new row
        Row newRow = rsi.createRow();
        //initialize the row
        newRow.setNewRowState(Row.STATUS_INITIALIZED);
        //add row to last index + 1 so it becomes last in the range set
        rsi.insertRowAtRangeIndex(lastRowIndex + 1, newRow);
        //make row the current row so it is displayed correctly
        rsi.setCurrentRow(newRow);
    }

On this fragment, I Cancel link that removes the added line and the value of the current row to a null value if no line is selected.


    private void cancelCreateRow(String iteratorName) {
        DCIteratorBinding binding = ADFUtils.findIterator(iteratorName);
        RowSetIterator rsi = binding.getRowSetIterator();
        Row currentRow = rsi.getCurrentRow();
        if (currentRow.getAttribute("Id") == null) {
            rsi.removeCurrentRow();
        }
        rsi.setCurrentRow(null);     
    }


The problem is that the last row is always selected. What I am doing wrong?

Hello

the link layer has always a selected line. You can't without a current line

Frank

Tags: Java

Similar Questions

  • Understand the iterator binding relationship of the current page

    Dear all

    in my quest to understand the behavior of the ADF framework, I sometimes do some experimentation. When a result is unlike what I think, it suggests that there is something wrong with the understanding

    I belong to those who can not work if I do not receive an overview comprehesive of what I am working with (ADF)

    Here's a simple experiment that I could use some help to understand

    I created a simple application based on ADF BC and JSF (10.1.2)

    The model is simple EO based on the EMP table and updatable VO based on the entity

    I slipped and fell to the control of data collection in a page as a Table with record selector

    I created a button with the following code

    Public Sub commandButton_action(ActionEvent a)
    {
    Am is AppModule_rs (AppModule_rs) ADFFacesHelper.getAppplicationModule ("AppModule_rsDataControl");. / / This just a helper class to get AM name DC
    ViewObject vo1 = am.findViewObject("EmpView1");
    VO1. Next();
    VO1. Next();
    System.out.println (VO1. GetCurrentRow(). GetAttribute ("empno")); -Read the valur of the iterator of VO
    DCIteratorBinding bd = ADFFacesHelper.getIteratorBinding ("EmpView1Iterator");
    System.out.println (BD. GetCurrentRow(). GetAttribute ("empno")); -Read the value of the iterator binding
    }

    Just simple code for in-house advance lines of two pointer line and then see how this is reflected in the page. This test is just for me to understand how the iterator binding refers to the actual set of rows.

    Scenario (1)

    -Run the page, the first line on the page is selected - planned, VO rowselector points on the first line
    -Click on the commandbutton control, the code above is executed
    -the rowselector forward twice and should point to the third row on VO
    -on the page of the third row must be selected
    RESULT: Match perfect and both command Print print the same value
    -Press and hold the control button, line guard page selector advances two lines at a time... which is good

    Scenario (2)

    -Run the page, the first line on the page is selected - planned, VO rowselector points on the first line
    -use the mouse and select the fourth row on the screen (not pressed) - VO is always level 1, screen on set, iterator binding binds to the rowset VO is always the first row referenes
    -Press the button
    -the page maintains its fourth selected line, while the System.out.println (vo1.getCurrentRow ().getAttribute("Empno")); prints the 7521 value which is the third - row
    -I don't feel happy, the current iterator of VO is on the third row, visually, it's fourth, which means that the selection of the user on the Web page did not consider. And this goes against my intiution


    -Press again, I find that line of page selector is the sixth line (4 + 2), therefore the iterator to all VO lines (synchornized times)

    Scenario (3)

    Run the page, the first line on the page is selected - planned, VO rowselector points on the first line
    -use the mouse and select the fourth row on the screen (not pressed) - VO is always level 1, screen on set, iterator binding binds to the rowset VO is always the first row referenes
    -Press the button SUBMIT - 4th place is always selected as expected
    -Now press the order button, you will see that line on the screen selector forward two rows and print indicates that the VO has also progressed to the same value
    -Se TRANSLATE only after pressing send, the frame cought his breath and synchronized things

    Coming background FORMS, things of this nature never would have happened with Disk Manager.

    I tried to project what has happened to the lifecycle ADF to try to understand how the interaction of the user affects the selection of lines, but was unable to reach a unified solution. What follows as an attempt for scenario (2)

    The user moves the selection to the fourth line
    The command button is pressed.
    Life cycle JSF begins with the RESTORATION of the VIEW.
    Apply request values (I guess the lines selection made by the user to become an integral part of request values?)
    Prepare the model (this is a post (postback), property of refreshment has ifNeeded, Binidng is created again and VO is always first in the poinitng)
    Validation process (no validation as no data entry)
    Model update (don't know if at this point the update of the line VO iterator? if so it should point to the fourth line)-doesn't seem to be the case
    Invoke the application, the listener of the action is executed and the VO is forced to move twice under the command button code
    Prepare the Render: it is a step where the link needs to be updated and reflect the currernt VO (rank 6) line
    Render: The page where the sixth line is selected

    where I am wrong! appreciate your comments

    It's what makes the difficult framework, if it is not clearly documented so the flow is very well understood by developers in one day, the developer must spend days and days debugging problems. This sure beats the idea of using frames to increase productivity

    I have

    Quick question - is the button that you add code to the same area (the "select and" area) as the button submit table?
    I'm guessing that it isn't and that the explanation is that just by clicking on a specific record in the table is not actually indicate to the controller layer is a selected line.
    The Send button did this update.
    One solution might be to set the autosubmit to the selected component to be true.

  • problem - by clicking on the button loses the new line or resets the iterator

    Hello

    I use JDev 11.1.1.6. I created a page that is preceded in the taskflow by a method in the AppModule that creates a line on the iterator and inserts it. I have a button 'Next' in the page, which is supposed to make changes to attribute readonly on the input fields, and display a confirmation button.

    The problem: when I click on 'next', the empty fields that have been entered by the user on the page, is part of the first record in the iterator. It is as if, when the button "Next" has been clicked, the iterator has been somewhat refreshed and moved to the first original line, and entered values have been thrown in there... While my 'new' record is lost. Result: I lose my new record line, and entered values replace the values in the first previous row in the iterator.

    The code used to create the line before the page is loaded:

    Sender ViewObjectImpl = getSubmittersView3_1();

    Submitter.Reset ();

    ViewRowImpl submitterRow = submitter.createRow () (ViewRowImpl);

    submitter.insertRow (submitterRow);

    When the page is loaded initially, I printed the primary key on the line and a - 4 (which is good, it means new line)

    But when I print the primary key in the action of the button 'Next', 59, who has been the pharmacokinetics of the first original line I.

    The code that is used to print the primary key:

    seqNum int = Integer.parseInt (this.getAppModule () .getSubmittersView3_1 () .getCurrentRow () .getAttribute (0) m:System.NET.SocketAddress.ToString ());

    Then print seqNum.

    Please help.

    Found the problem.

    I had a button print at the bottom, which was my button "Cancel". In this paper, I got the code to remove additional items (i.e. unwanted ranks - since it is a Cancel button). And what was going on was that while rendering on the page, the code of the EEG for the go button was running and the removal of my new line! If the culprit here was go get code button is iterated in the rendering phase... something I didn't expect or know so far. Remove this code and change a command button solves the problem.

  • refresh the iterator binding

    Dear experts.

    I created EO of mySQL database then simple VO (SELECT Sounds.idresources, Sounds.resourceaccess OF resources sounds). On site jspx, I joined VO tabular and created a button to INSERT a new row in table of mySQL directly via the command preparedStatement.

    At the end of a method, I executed:

    DCBindingContainer DCB = BindingContext.getCurrent () .getCurrentBindingsEntry () (DCBindingContainer);

    DCIteratorBinding iter = DCB.findIteratorBinding ("VO_SOUNDS1Iterator");

    iter.getViewObject () .clearCache ();

    iter.executeQuery ();

    iter.clearForRecreate ();

    AdfFacesContext.getCurrentInstance () .addPartialTarget (this.getT1 ());

    to update the table and see new inserted row. Unfortunately modifications are not visible. I have to navigate between the other pages to see a correct result.

    Any help would be appreciated.

    Kind regards.

    Hello

    I checked your application, the problem seems to be that the VO is using different transactions than the transaction used for insertion.

    Quite simply, use AppModule commit to posting your changes instead of conn.Commit () in your method.

    To do this, add Commit action binding to your pagedef and use this validation instead of Conn.Commit (); in your insertRecord method

    or use the same transaction AppModule uses for insertion

    Example Code:

        public void insertRecord(String tbl, String connStr) {
            String sql = "INSERT INTO " + tbl + "(col1,col2) VALUES(?,?)";
            PreparedStatement preparedStatement = null;
            DBTransaction trans = null;
    
            try {
                DCIteratorBinding iter =
                    (DCIteratorBinding) BindingContext.getCurrent().getCurrentBindingsEntry().get("VO_mySQL1Iterator");
    
                DCDataControl dc = iter.getDataControl();
                ApplicationModuleImpl appModule = (ApplicationModuleImpl) dc.getDataProvider();
    
                trans = appModule.getDBTransaction();
    
                //Following section is needed only when you connect to different datasource other than the one defined in AppModule
                InitialContext ctx = new InitialContext();
                DataSource ds;
                ds = (DataSource) ctx.lookup("jdbc/mysqlDS");
                if(trans.isConnected())
                {
                    trans.disconnect(true);
                    trans.connectToDataSource(ds, false);
                }
    
                preparedStatement = appModule.getDBTransaction().createPreparedStatement(sql, DBTransaction.DEFAULT);
                preparedStatement.setString(1, "user");
                preparedStatement.setString(2, "name");
                preparedStatement.executeUpdate();
    
                trans.commit();
            } catch (Exception e) {
                e.printStackTrace();
            }finally{
                try {
                    if(preparedStatement != null)
                        preparedStatement.close();
                    if(trans != null)
                        trans.closeTransaction();
                } catch (SQLException sqle) {
                    sqle.printStackTrace();
                }
            }
        }
    

    Jean Lou

  • Not able to reset the InputText binding

    Hi team,

    Jdev - 11.1.1.6

    Scenario-

    I have a jsff page (bankPage) and in which I have a few inputtext, Radiobutton, etc.

    On the same page, I have a button Save and Cancel button.

    When I come to the page and I try to enter a value in the input field and click on the button cancel, its not reset my InputText value.

    When I'm on the same page again, I can learn my value previously entered in Input text fine that I clicked on Cancel.

    I wrote Action Listnere on the Cancel button and wrote code below

    input.resetValue() ;

    adfFacesContext.addPartialTarget(input);

    But this is not resettiing my values.

    I also tried ResetUtils.reset (input);

    But still not able to reset my IputText.

    Please help me,

    Thanks in advance.

    Thank you

    Céline

    then, instead of food, try it with

    Row.Refresh(Oracle.jbo.Row.REFRESH_UNDO_CHANGES |)  Row.REFRESH_FORGET_NEW_ROWS);

  • How to add the iterator binding to a flow of the page?

    ADF/JDEV 11gR1PS1

    Hello

    I noticed in the example of Andrejus Baranovskis here
    http://andrejusb.blogspot.com/2008/09/JDeveloper-11g-CRUD-in-ADF-form.html

    that the flow of the page has an interator binding, allowing you to have an affair of create method in the workflow instead of via a bean.

    I tried to manually replicate what was in his project, but it does not work. I wonder how to do so, but also how to call a method of a workflow AM (I remember seeing that in the demo as well DOM). I can't explain either.

    Thank you.

    You should be able to drag just the method of control of data on the adfc - config.Xml. It must insert the necessary items.

    Timo

  • Iterator binding: access the value of a column

    Hello

    Is there a way to access the value of a specific column from an af:table by EL, using the iterator binding? I know how to do this by adding an < attributeValues > affair in the pageDef file. But I'm just curious to know if it is possible without this 'thing '.

    For example, suppose we have a table, linked to a view object:
    <af:table id="t1" value="#{bindings.Employees1.collectionModel}" var="row" ...>
      <column headerText="Emp Id" id="c1" ...>
        <af:outputText value="#{row.EmployeeId}" id="ot1" .../>
      </column>
    </af:table>
    And below, a simple command button:
    <af:commandButton text="test button"/>
    Now, how can I set the disabled property of the CommandButton to be true, THAT when the selected row in the table has an EmployeeId of 200? So what I would do:
    <af:commandButton text="test button" 
    disabled="#{bindings.Employees1.collectionModel.currentRow.EmployeeId eq '200'}"/>
    But so far, I have not found the correct EL expression to do. I realize that it is quite an abstract example, but it is a concept that I need a lot, and I wonder what is the cleanest solution... :-)

    Thank you!

    Chris

    Published by: Chris Schryvers on December 1st, 2009 03:22

    Hi Chris,

    .... I use JDev 11.1.1.2.0...

    I have to do this:

    1. drag an EmployeeId (from your display in your dataControl) in the page as an outputText.
    2. make this false outputText visibility.
    3. in your Disabled property wirte commandButton control this EL:
    #{bindings. EmployeeId.inputValue is '200'}
    Or
    #{bindings. {EmployeeId.inputValue-eq ' 200'}.
    PartialTrigger 4-set of the outputText and the CommandButton with the table ID.

    your command button will be like this:


    ID = "cb1".
    Disabled = ' #{bindings. " EmployeeId.inputValue is '200'}'
    partialTriggers = "t1" / >

    Sameh Nassar

  • value of autoHeightRows dynamic and iterator binding rangesize-1

    I have a page in which the user is authorized to determine the number of lines that are shown in the table. I have a bean support with an int memorizing the chosen user number and a drop-down list on the page that autosubmits its value and the value of autoHeightRows in the table is set to the value in the bean support. The fetchSize is assigned to the rangeSize of the iterator binding, which is the default value.

    I put the rangesize of the iterator stuck-1, that would mean "infinite" so that it doesn't bother us when for example the user said 'Give me 500 rows in this table', but somehow I never had more than 25 lines and a scroll bar on the thought. I changed it to 500 and voila, everything works exactly as I wanted it.

    My question is, what is the difference in behavior between - 1 and 500 rangeSize? The underlying viewobject said "extract all lines as needed", while the magic number of 25 whence?

    Hello

    11 g R1 25 is the default setting for rangeSize in the mandatory PageDef iterator, what happens if you

    -l'autoHeightRows the value 0
    -FetchSize to the managed bean
    -iterator binding-1

    I think that the table may be a problem with the size of the extraction in value a negative number

    Frank

  • reset the counter of iteration completion

    Hello

    I use the meter to iteration within a while loop to measure the duration of a process. If I finish running the program and run it again, the iteration count does not reset to 0. How can I make it automatically reset at the end (or beginning) of execution?

    You have over the Terminal to initialize it with zero.

  • Bind variable: always related to the current attribute of the iterator line

    Hi, OTN,.
    Need some help with the variable binding query of the view object.

    I have a VO1 with: PARAM in a subquery in the WHERE clause.
    This: PARAM must always be equal to the current attribute of the iterator of VO2 line.

    VO1 and VO2 are not related, but their of1 and EO2 entities has an association.

    VO2 is exposed as an array on my page, so I did it with the table selection listener.
    He calls makeCurrent parameter named where clause param for VO1 and VO2.

    This method works, but the problem is selection listener is called only when a table row is explicitly selected.
    The current row of the iterator can be changed whithout table selection, such as sorting or the parent navigation of VO...

    Is there a world better, maybe a declarative method for this problem?
    Thank you.

    Example query VO1:
    SELECT ... FROM EO1
    WHERE ID != (SELECT ID FROM ... WHERE attr = :PARAM)
    JDeveloper 11.1.1.3, AD, BC

    I guess you try relationship master / detail (Table-based form)... you must see link
    Refer to this:
    http://download.Oracle.com/docs/CD/E14571_01/Web.1111/b31974/web_masterdetail.htm#ADFFD761
    Chapter 24 - master data display / detail

    Amit

  • use the anterior region iterator binding in the workflow

    Build JDEVADF_11.1.1.4.0_GENERIC_101227.1736.5923
    Hello

    I use a region with stubborn workflows. in my first area I use a query and an array of result. in my table is a link to us a flow of control in the detail area (jsff).
    I like to use next, previous navigation in the detail page, but how can I use the iterator from the first page of the operation (next, previous)?

    THX Thomas

    Thomas,

    Just use the iterator of the data control in the second jsff then.

    John

  • How to bind the iterator/vo model component?

    Hello

    I have a tree in my page template that must be accessible throughout the entire application.
    The application will have hundreds of pages, so it would be pretty boring if we have to redefine the iterator & vo in every single page def.

    Is there a way to tie the tree to the definition of the model of the page? Or maybe to other pages inherit def of the template?

    Thanks in advance,

    Charles.

    Charles,

    Enjoy the Fusion developer's Guide (I assume you are using 11g).

    18.2.1 article talks about how to use data links in a page template.

    John

  • How to reset the file input form after submitting the form with an ADF file

    I use oracle 12 c. I have a form where I have 3 fields and an af:inputFile where I need to download the file and the final backup.

    I can't use for inputFile valueChangeEvent because if I user ResetUtils then I won't get the invalid entry form.

    On record everything works fine but when I add once again a record then the last file update still shows in inputFile (its not reset).

    After save if I set the binding of the null input file then do partial trigger for the component by using its page load Binder takes a huge time to save so I can't use it.

    Here is my code

    < af:panelFormLayout id = "pfl1" rows = "3" >

    < af:inputText value = "#{bindings." Filename.inputValue}"label =" #{bindings. " Filename.hints.label}.

    required = "#{bindings." Filename.hints.Mandatory}.

    columns = "#{bindings." Filename.hints.displayWidth}.

    maximumLength = "#{bindings." Filename.hints.Precision}.

    shortDesc = "#{bindings." Filename.hints.ToolTip}"id ="9 ".

    contentStyle = "width: 150px" showRequired = "true" >

    < f: validator binding = "#{bindings." Filename.Validator} "/ >"

    < / af:inputText >

    < af:panelGroupLayout id = "pgl350" layout = "horizontal" >

    < af:inputFile label = "Select" id = "if51" value = "#{ContractDocumentUploadDwn.file} '"

    showRequired = "true" binding = "#{ContractDocumentUploadDwn.inputFileBinding}" / >

    < af:button text = "Upload" id = "b353" action = "#{ContractDocumentUploadDwn.uploadPortfolioDoc}" / >

    < / af:panelGroupLayout >

    < / af:panelFormLayout >

    Java code:

    {} public void savePortfolioDoc (ActionEvent actionEvent)

    Add the code in the event here...

    DCIteratorBinding iter = getDCIteratorBinding ("portfolioDocument1Iterator");

    UploadedFile myfile = this.getInputFileBinding () .getValue () (UploadedFile);

    String link = "Commit1";

    String popUpId = "p2";

    genericSaveDocuments (actionEvent, iter, myfile, lie, popUpId, "Portfolio"); Saves the document

    iter.executeQuery ();

    ITER. Refresh (1);

    setInputFileBinding (null);

    ResetUtils.reset (actionEvent.getComponent ());

    }

    Please help me

    See this line in your code

    You use a variable as the inputFile value so you must set its value to null

    Write like this-

    this.setFile (null);

    Reset the inputFile component after download

    ResetUtils.reset (inputFileBinding);

    Ashish

  • Create a table in a loop 'for' (reset the number of loops)

    Hello

    I try to incorporate a signal of acceleration from an analog input CRIO to get speed and then further integrate to get the moving of a vibration system.

    I understand that to achieve integration, a table must be fed in. My problem is that I could not buffer the signal in a buffer block, as I couldn't find buffer blocks. so I decided to create my data table by using a loop "for". The nests of the loop 'for' inside a timed loop. The problem that I'm stuck on is how to reset the loop 'for' in order to fill the buffer with each iteration of the outer loop timed.

    I enclose the code if that helps. Note that I use labview in 2013.

    If anyone who has encountered a similar problem before can help me, I would be gratefull.

    Concerning

    Ali

    You can use a shift register initialized as inputs to your curls, to build your table of one. However, you realize, don't you, that the execution of your program as written loops as soon as the computer can spit out responses, then the output array may contain several points that took place before the entry has updated? Assuming that your thing cRIO (I've not worked with these) has integrated into its routine acquisition of calendar data, I suggest you put that inside the loop to get a data point by reading.

    And do you really want your graph to distance for update only every thousand points (points of acceleration million) speed?

    Cameron

  • Reset the XY graph

    Hello

    I have a problem with my graph xy, the program receives the data from the excel files and he made several operations after that, I send the results to a xy chart, now I'm trying to reset the graph each 100 iteration to avoid saturation of the data on the chart.

    I tried to do it with shift register, structures of the case and I failed.

    If anyone can help me, I'd appreciate your help.

    I have attached a picture.

    This is what you want?

Maybe you are looking for

  • Dv2804tx HD partition

    I just got my book of after-sale service for repair, the problem was the motherboard, so that they succeeded him and installed a new operating system and drivers. As I came home and use it I discovered that there is only a single player who is C with

  • Failed to upgrade HP Support Assistant

    I have a new Pavilion m6-1045dx running on Win 7 64 bit.  Recently I tried to update the HP Support Assistant 6.1.12.1, but it failed.  At the opening of the SA there is a high bar message saying "an error has occurred."  On the bottom, the name of t

  • HP Mini 210-3000sb

    Hey everybody, I recently bought a Mini 210-3000sb. I needed a portable light for the school. Currently, I am very happy with it, it works well and is very convenient. But I have to use a big program for my programming, so I could use a few more RAM.

  • Account comments wireless problems

    Hello. We have a new wireless network that includes the System Console wireless, two 4402 controllers and 61-1131 AP it seems that when a user logs on to the guest wireless account and connects to a particular access point, a user who may be sitting

  • Newbie: control the automatic progression

    I'm new to Captivate 9 and I'm trying to come to terms with the reading head automatically progresses.The course that I build a custom navigation and therefore I hid the standard playback bar.I need to progress to the next slide occurs only when the