How to add entire new row at the top of table in pdf report from c# windows forms using iTextSharp

Hi for past 3 days i was thinking and breaking my head on how to add entire new at top table created in pdf report from c# windows forms with iTextSharp.
First: I was able to create/export sql server data in form of table in pdf report from c# windows forms. Given below is the code in c#.
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Text;
using System.Data;
using System.IO;
using System.Data.SqlClient;
using System.Windows.Forms;
using iTextSharp.text;
using iTextSharp.text.pdf;
namespace DRRS_CSharp
public partial class frmPDFTechnician : Form
public frmPDFTechnician()
InitializeComponent();
private void btnExport_Click(object sender, EventArgs e)
Document doc = new Document(PageSize.A4.Rotate());
var writer= PdfWriter.GetInstance(doc, new FileStream("Technician22.pdf", FileMode.Create));
doc.SetMargins(50, 50, 50, 50);
doc.SetPageSize(new iTextSharp.text.Rectangle(iTextSharp.text.PageSize.LETTER.Width, iTextSharp.text.PageSize.LETTER.Height));
doc.Open();
PdfPTable table = new PdfPTable(7);
table.TotalWidth=585f;
table.LockedWidth = true;
PdfPTable inner = new PdfPTable(1);
inner.WidthPercentage = 115;
PdfPCell celt=new PdfPCell(new Phrase(new Paragraph("Institute/Hospital:AIIMS,NEW DELHI",FontFactory.GetFont("Arial",14,iTextSharp.text.Font.BOLD,BaseColor.BLACK))));
inner.AddCell(celt);
Paragraph para = new Paragraph("DCS Clinical Report-Technician wise", FontFactory.GetFont("Arial", 14, iTextSharp.text.Font.BOLD, BaseColor.BLACK));
para.Alignment = iTextSharp.text.Element.TITLE;
iTextSharp.text.Image png = iTextSharp.text.Image.GetInstance("logo5.png");
png.ScaleToFit(95f, 95f);
png.Alignment = Element.ALIGN_RIGHT;
SqlConnection conn=new SqlConnection("Data Source=NPD-4\\SQLEXPRESS;Initial Catalog=DRRS;Integrated Security=true");
SqlCommand cmd = new SqlCommand("Select t.technician_id,td.Technician_first_name,td.Technician_middle_name,td.Technician_last_name,t.technician_dob,t.technician_sex,td.technician_type from Techniciandetail td,Technician t where td.technician_id=t.technician_id and td.status=1", conn);
conn.Open();
SqlDataReader dr;
dr = cmd.ExecuteReader();
table.AddCell("ID");
table.AddCell("First Name");
table.AddCell("Middle Name");
table.AddCell("Last Name");
table.AddCell("DOB" );
table.AddCell("Gender");
table.AddCell("Designation");
while (dr.Read())
table.AddCell(dr[0].ToString());
table.AddCell(dr[1].ToString());
table.AddCell(dr[2].ToString());
table.AddCell(dr[3].ToString());
table.AddCell(dr[4].ToString());
table.AddCell(dr[5].ToString());
table.AddCell(dr[6].ToString());
dr.Close();
table.SpacingBefore = 15f;
doc.Add(para);
doc.Add(png);
doc.Add(inner);
doc.Add(table);
doc.Close();
The code executes well with no problem and get all datas from tables into table in PDF report from c# windows forms.
But here is my problem how can i align Title(DCS Clinical Report-Technician wise) center of pdf report with image named:logo5.png immediately coming to it's right?.
As the problem i am facing is my title or Header(DCS Clinical Report-Technician wise) is at top of my image named:logo5.png and not coming to it's center position of my image.
Second the problem i am facing is how to add new entire row to top of existing table in pdf report from c# windows form using iTextSharp?.
given in below is the row and it's data . So how do i add the given below row and it's data to my top my table in pdf report from c# windows forms using itextsharp?
as you can see how i create my columns in table in pdf report and populate it with sql server data. Given the code below:
Document doc = new Document(PageSize.A4.Rotate());
var writer= PdfWriter.GetInstance(doc, new FileStream("Technician22.pdf", FileMode.Create));
doc.SetMargins(50, 50, 50, 50);
doc.SetPageSize(new iTextSharp.text.Rectangle(iTextSharp.text.PageSize.LETTER.Width, iTextSharp.text.PageSize.LETTER.Height));
doc.Open();
PdfPTable table = new PdfPTable(7);
table.TotalWidth=585f;
table.LockedWidth = true;
Paragraph para = new Paragraph("DCS Clinical Report-Technician wise", FontFactory.GetFont("Arial", 14, iTextSharp.text.Font.BOLD, BaseColor.BLACK));
para.Alignment = iTextSharp.text.Element.TITLE;
iTextSharp.text.Image png = iTextSharp.text.Image.GetInstance("logo5.png");
png.ScaleToFit(95f, 95f);
png.Alignment = Element.ALIGN_RIGHT;
SqlConnection conn=new SqlConnection("Data Source=NPD-4\\SQLEXPRESS;Initial Catalog=DRRS;Integrated Security=true");
SqlCommand cmd = new SqlCommand("Select t.technician_id,td.Technician_first_name,td.Technician_middle_name,td.Technician_last_name,t.technician_dob,t.technician_sex,td.technician_type from Techniciandetail td,Technician t where td.technician_id=t.technician_id and td.status=1", conn);
conn.Open();
SqlDataReader dr;
dr = cmd.ExecuteReader();
table.AddCell("ID");
table.AddCell("First Name");
table.AddCell("Middle Name");
table.AddCell("Last Name");
table.AddCell("DOB" );
table.AddCell("Gender");
table.AddCell("Designation");
while (dr.Read())
table.AddCell(dr[0].ToString());
table.AddCell(dr[1].ToString());
table.AddCell(dr[2].ToString());
table.AddCell(dr[3].ToString());
table.AddCell(dr[4].ToString());
table.AddCell(dr[5].ToString());
table.AddCell(dr[6].ToString());
dr.Close();
table.SpacingBefore = 15f;
doc.Add(para);
doc.Add(png);
doc.Add(table);
doc.Close();
So my question is how to make my column headers in bold?
So these are my questions.
1. how can i align Title(DCS Clinical Report-Technician wise) center of pdf report with image named:logo5.png immediately coming to it's right?.
2. how do i add the given below row and it's data to my top my table in pdf report from c# windows forms using itextsharp?
3.how to make my column headers in bold?
I know that i have to do some modifications to my code but i dont know how to do it. Can anyone help me please.
Any help or guidance in solving this problem would be greatly appreciated.
vishal

Hi,
>>1. how can i align Title(DCS Clinical Report-Technician wise) center of pdf report with image named:logo5.png immediately coming to it's right?.
2. how do i add the given below row and it's data to my top my table in pdf report from c# windows forms using itextsharp?
3.how to make my column headers in bold?<<
I’m sorry for the issue that you are hitting now.
This itextsharp is third party control, for this issue, I recommended to consult the control provider directly, I think they can give more precise troubleshooting.
http://sourceforge.net/projects/itextsharp/
Thanks for your understanding.
Regards,
Marvin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • How to add a new row at the top of manual tabular form

    I have a manual tablular form. I'm trying to add a row at the top of the form, instead of new row of being displayed at the bottom. any ideas are appreciated.
    thanks,
    Surya

    This will depend on two things:
    1. sorting of the columns - needs to be a some kind of a descending sorting on a hidden column, enabled within the Report Attributes and not in the SQL Query
    2. Report Attributes => Layout and Pagination => Sort Nulls First
    You will need to play with those settings a bit. One thing to consider is that you should sort your report on a hidden column and you shuldn't enable the sorting on visible columns, because it will mess up your row positioning.
    See this example:
    http://apex.oracle.com/pls/otn/f?p=31517:215
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • Add a new row at the top of a table in GUI

    Hi,
    I am using JDev 11.1.1.1.0. I need to be able to let users add a new row at the top of a table and not anywhere else in the middle of table rows. I cannot seem to find a way to do it. note that it does not matter where a new row gets inserted in the db, i am only concerned about restricting the insert in the GUI to the topmost line/row.
    Thanks,
    AJ

    Hi
    Can you try with writing your custom create method in application module and calling same from UI on command button action like
    public void createNewRow()
    ViewObjectImpl vo = getVO1();
    Row newRow= vo.createRow()
    vo.insertRowAtRangeIndex(0, newRow);
    Vikram

  • How to add A single row at the middle of the table in a Webi report

    Hi,
         I created a Webi report using Universe(Created universe using bex query).Now i have a requirement to display a row at the middle of a report. Can you please tell me ,how to add a sigle row at the middle of a Webi report.
                                                    Thanks in advance
    Regards
    Monika

    Hi Monika,
    It is not really possible to add a row (I assume you mean of unrelated data) to the middle of a table in a report. You can add a new table with a single row between two tables. For instance you could add a new one row table, or even single cells which are positioned relatively between two tables. Possibly a block on top of another. But this gets tricky.
    Can you explain in more detail what you are trying to do?
    Thanks

  • How to insert a new row in the middle of an set of rows

    Hi
    How to insert a new  row in the middle of an set of rows ? and How to Reset the line id after the new row added ?
    Regards,
    Sudhir B.

    Hai,
    just try this,
    Instead of using omatrix.Addrow(1,-1) use like
    omatrix.AddRow( RowCount , Position)
    RowCount
    The number of rows to add (default is 1)
    Position
    The position of the new rows (0-based; default is -1, meaning append row to the end)
    After adding rows in matrix For, sno.
    for i=1 to omatrix.visualrowcount
    otext=omatrix.getcellspecific("columnid",i)  '--where columnid is the unique id of the sno column
    otext.value=i
    next i
    Hope this helps you.
    Thanks & Regards,
    Parvatha Solai.N

  • How to add a new tab for the project?

    Dear All Experts,
        Could you tell me how to add a new tab for the project?
        Pls refer to the screenshot as below:
    Thanks!
    Xinling Zhang

    Hi,
        The new tab in cj20n , and the new tab can only be displayed in the highed level.Pls refer to below
        And in cj02, there is no this tab also in the wbs detailed screen,
    Thanks!
    Xinling

  • Need to add a new row at the end of the table

    Experts,
    working jdev 11.1.1.3.0
    i am adding row programetically, my requirement need to add the row at after last row.
    i tried different ways.
    Row newLastRow = getPWBBidLaneVO().last();
    int lastRowIndex = getPWBBidLaneVO().getRangeIndexOf(newLastRow);
    getPWBBidLaneVO().insertRowAtRangeIndex(lastRowIndex - 1,
    laneRow);
    this is giving --- java.lang.ArrayIndexOutOfBoundsException: 0
    and
    http://kohlivikram.blogspot.com/2008/10/add-new-row-in-adf-table-on-button.html --- its giving index out of bound because vo.getRangeSize() is 25. We set this value at vo for performance improment suggestions.
    is there a way to add a new row at the end of the table?

    Add this to the view row impl class
           public void insertRow(Row row) {
               //go to the end of Rowset if it has rows
               Row lastRow = this.last();
               if (lastRow !=null){
                    //insert new row at the end and make it current
                   int indx = this.getRangeIndexOf(lastRow)+1;
                   this.insertRowAtRangeIndex(indx,row);
                   this.setCurrentRow(row);
               }else { // empty Rowset
               super.insertRow(row);
               }

  • How to add new row at the top of the advance table.

    Hi,
    I have one advanced table.
    I want to add new rows in advanced table. I can able to add rows using the AddMoreRows button in the footer of the advanced table.
    This adds the row at the end. But I want to add the row at the top.
    How to achive this? Please suggest.
    Thanks & Regards,
    Raja

    Hi,
    Yes you can do it...
    Just set the add Rows automatically property to False of Add Row Button
    and then in processForm Request capture the addRows event
    and invoke a method in AM and then create a new Row in VO.
    Use this code...it will insert row at the top...
    if("addRows".equals(event))
    am.invokeMethod("addrows");
    public void addrows()
    AddressesVOImpl vo1 = getAddressesVO1();
    AddressesVORowImpl row1 = (AddressesVORowImpl)vo1.createRow();
    vo1.insertRowAtRangeIndex(0,row1);
    vo1.setCurrentRow(row1);
    Thanks,
    Gaurav

  • How to add a new Element to the Context

    Hello all.
    I created in the wdInit()
    ArrayList datas = new ArrayList();
         for (int i = 0; i < 25; i++) {
              MyData data = new MyData();
              data.setMethods();
              datas.add(data);
         wdContext.nodeMyData().bind(datas);
    Now, I want by clicking on the Button "Create new Element", forward user to the other View, which elements are connected with the same model -> context, the new element should be added to context, the user should fill the form and click Save-Button.
    How can I add a new Element to the Collection I created and choose it as a current element?
    If I do: wdContext.nodeMyData().bind(new MyData()) all information will be lost. And I will have only one field.
    If I do it like this:
    IWDNodeElement dynTabElem=(IWDNodeElement)wdContext.nodeMyData().createElement();
    wdContext.nodeMyData().addElement(dynTabElem);
    I get an error: com.sap.tc.webdynpro.progmodel.context.ContextException: NodeInfo(DataComp.MyData): value node is created without a reference
    Well I can pass to my new View a Collection as a parameter and then
    Collection.add(new MyData()) and then bind it. But I find this solution not good.
    Is there any possibility to get the existing Collection from the Context without passing it to the view?
    Can I just add a new element to the existing collection?
    Thanks in advance.

    Hallo Monalisa,
    I did as you said. But I can't add something to my model class, because it is not collection.
                            MyData data = wdContext.currentBelegElement().modelObject();
                   data.add() ???? - don't work
                   wdContext.nodeMyData().invalidate();

  • How to add a new status to the Status drop down menu in CRM

    Hi All,
    Help me guyz i am new to CRM,
    i have to add a new status to the Status drop down menu in CRM Sales Area.
    Please help me for steps.
    Thanks
    DST

    Hi,
    You can add New status to the Drop Down menu by defining a catalog,codegroups & code group profiles to that...... Once assigned assign them to the Subject profiles and assign this subject profile to the transaction type that is assigned.
    This would populate all the profiles that u have mentioned in the subject profile.
    Award points if this answer helps you.
    Regards,
    Ravi

  • How to add a dummy row in the result set of a SELECT statement.

    Hello Everyone -
    I have requirment to add a dummy row in the result set of a SELECT statement.
    For e.g. lets say there is a table Payment having following colums:
    Payment_id number
    status varchar2(10)
    amount number
    payment_date date
    so here is the data :-
    Payment_id Status Amount payment_date
    1 Applied 100 12/07/2008
    2 Reversed 200 01/ 06/2009
    3 Applied 300 01/ 07/2009
    Here is my SQL
    Select * form payment where payment_date >= 01/01/2009
    Output will be
    2 Reversed 200 01/ 06/2009
    3 Applied 300 01/ 07/2009
    My desired output is below
    2 Reversed 200 01/ 06/2009
    3 Applied 300 01/ 07/2009
    2 Reversed -200 01/ 06/2009 ------(Dummy Row)
    Thrid row here is the dummy row which I want to add when status is "Reversed"
    I would be very thankful for any kind of help in this regard ...
    Thanks,
    Gaurav

    Cartesion joining against a dummy table is a useful method of creating a dummy row:
    with my_tab as (select 1 cust_id, 1 Payment_id, 'Applied' Status, 100 Amount, to_date('12/07/2008', 'mm/dd/yyyy') payment_date from dual union all
                    select 1 cust_id, 2 Payment_id, 'Reversed' Status, 200 Amount, to_date('01/06/2009', 'mm/dd/yyyy') payment_date from dual union all
                    select 1 cust_id, 3 Payment_id, 'Applied' Status, 300 Amount, to_date('01/06/2009', 'mm/dd/yyyy') payment_date from dual union all
                    select 2 cust_id, 1 Payment_id, 'Applied' Status, 100 Amount, to_date('12/07/2008', 'mm/dd/yyyy') payment_date from dual union all
                    select 2 cust_id, 2 Payment_id, 'Reversed' Status, 200 Amount, to_date('01/05/2009', 'mm/dd/yyyy') payment_date from dual union all
                    select 2 cust_id, 3 Payment_id, 'Applied' Status, 300 Amount, to_date('01/06/2009', 'mm/dd/yyyy') payment_date from dual union all
                    select 2 cust_id, 4 Payment_id, 'Reversed' Status, -400 Amount, to_date('01/06/2009', 'mm/dd/yyyy') payment_date from dual union all
                    select 2 cust_id, 5 Payment_id, 'Applied' Status, 500 Amount, to_date('01/07/2009', 'mm/dd/yyyy') payment_date from dual),
                    --- end of mimicking your table
          dummy as (select 'Reversed' col1, 1 rn from dual union all
                    select 'Reversed' col1, 2 rn from dual)
    select mt.cust_id,
           mt.payment_id,
           mt.status,
           decode(dummy.rn, 2, -1*mt.amount, mt.amount) amount,
           mt.payment_date
    from   my_tab mt,
           dummy
    where  mt.status = dummy.col1 (+)
    order by mt.cust_id, mt.payment_id, dummy.rn nulls first;
    CUST_ID     PAYMENT_ID     STATUS     AMOUNT     PAYMENT_DATE
    1     1     Applied     100     07/12/2008
    1     2     Reversed     200     06/01/2009
    1     2     Reversed     -200     06/01/2009
    1     3     Applied     300     06/01/2009
    2     1     Applied     100     07/12/2008
    2     2     Reversed     200     05/01/2009
    2     2     Reversed     -200     05/01/2009
    2     3     Applied     300     06/01/2009
    2     4     Reversed     -400     06/01/2009
    2     4     Reversed     400     06/01/2009
    2     5     Applied     500     07/01/2009Edited by: Boneist on 07-Jan-2009 23:10
    NB. You may have to mess around with the ordering if that's not come back in the order you wanted. You didn't mention what the rules were for any expected ordering though, so I've made up my own *{;-)
    Also, I added an identifier (cust_id) to differentiate between different sets of payments, since that's usually the case. Remove that if it's not applicable for your case.

  • How to add a new Field to the WEB User Interface in CRM 2007

    Dear experts,
    I have been struggling to add a new field to the (CRM 2007) user interface from available fields for a specific view.
    I have maintained settings in BS__WD_CMPWBàRuntime Repository editoràComponentàViewàConfigurationàNew ConfigurationàAvailable FieldsàField Propertiesàand save.
    But the field is only appearing in display mode in the Web UI, which doesnu2019t allows any user input.
    I need your help to resolve the issue, I would be grateful if you could provide step-by-step documentation with screenshots or any other kind of documentation.
    Each suggestion will be appreciated.
    Best regards,
    Raghu ram.

    Hi Raghu Ram,
    I think you added a new custom field using some method like EEWB etc.,
    Then, you are adding the field onto the UI using UI Configuration Tool .. right ?
    These are the steps to diagnose:
    Method 1.Check the field properties in the model browser first.
      It should be showing 'C' i.e., CHANGEABLE. If it is showing as 'R', it is only READABLE.
      In such a case you need to find a BADI to change the field properties.
      For example, in Marketing Applications OBJ BADI has a method CHANGE FIELD PROPERTIES for this purpose.
    Method 2. Debug and check what is the value coming for RV_DISABLED parameter in the GET_I method in BSP_WD_CMPWB. This should be FALSE.
    Method 3. Check what are the field properties in the UI Configuration tool.
    Make sure it is not a display only field.
    Regards,
    Masood Imrani S.

  • How to Add a new fields in the selection screen of LDB.

    Hi All,
    I want to add a new fields in the selection screen of LDB & then i need to select the data for that fields.
    So could you please tell me for that where i need to add the code for selecting the data.
    Thanks
    Roli

    Hi
    welcome to SDN forum
    If you are designing your own LDB with your own tables you can define tree structure and then the selection screen for the tables
    if you wants to modify the std LDB of SAp means take the access key and to modify that code
    if you add the extra field you have to modify the where conditions in the code also
    see the doc
    A logical database is a special ABAP/4 program which combines the contents of certain database tables. You can link a logical database to an ABAP/4 report program as an attribute. The logical database then supplies the report program with a set of hierarchically structured table lines which can be taken from different database tables.
    LDB offers an easy-to-use selection screens. You can modify the pre-generated selection screen to your needs. It offers check functions to check whether user input is complete, correct, and plausible. It offers reasonable data selections. It contains central authorization checks for data base accesses. Enhancements such as improved performance immediately apply to all report programs that use the logical database.
    Less coding s required to retrieve data compared to normal internel tables.
    Tables used LDB are in hierarchial structure.
    Mainly we used LDBs in HR Abap Programming.
    Where all tables are highly inter related so LDBs can optimize the performance there.
    Check this Document. All abt LDB's
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.highlightedcontent?documenturi=%2flibrary%2fabap%2fabap-code-samples%2fldb+browser.doc
    GO THROUGH LINKS -
    http://www.sap-basis-abap.com/saptab.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9bfa35c111d1829f0000e829fbfe/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9b5e35c111d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c6/8a15381b80436ce10000009b38f8cf/frameset.htm
    /people/srivijaya.gutala/blog/2007/03/05/why-not-logical-databases
    Re: **LDB**
    www.sapbrain.com/FAQs/TECHNICAL/SAP_ABAP_Logical_Database_FAQ.html
    www.sap-img.com/abap/abap-interview-question.htm
    www.sap-img.com/abap/quick-note-on-design-of-secondary-database-indexes-and-logical-databases.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9b5e35c111d1829f0000e829fbfe/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db9bb935c111d1829f0000e829fbfe/content.htm
    Gothru the blog which provides info on LDB's:
    /people/srivijaya.gutala/blog/2007/03/05/why-not-logical-databases
    Sample code
    TABLES: SPFLI,
    SFLIGHT,
    SBOOK,
    SCARR.
    START-OF-SELECTION.
    GET SPFLI.
    WRITE:/ ’SPFLI: ’, SPFLI-CARRID, SPFLI-CONNID,
    SPFLI-AIRPFROM, SPFLI-AIRPTO.
    GET SFLIGHT.
    WRITE:/ ’ SFLIGHT: ’, SFLIGHT-CARRID, SFLIGHT-CONNID, SFLIGHT-FLDATE.
    GET SBOOK.
    WRITE:/ ’ SBOOK: ’, SBOOK-CARRID, SBOOK-CONNID,
    SBOOK-FLDATE, SBOOK-BOOKID.
    GET SFLIGHT LATE.
    WRITE:/ ’ GET SFLIGHT LATE: ’, SFLIGHT-FLDATE.
    Regards
    anji

  • CreateInsert puts the new row at the top or second to the last

    Dear All,
    Just one question, is it possible to configure that when you create a new row in an
    editable table, it will be place at the end of the rows of the table?
    Use Case:
    I have a view object coming from the HR schema's Departments table.
    I then dropped this page as an editable table and enabled row selection.
    To add new row, I drag the create insert option as a button.
    <af:form id="f1">
    <af:panelStretchLayout id="psl1">
      <f:facet name="bottom">
         <af:panelGroupLayout id="pgl1">
           <af:commandButton text="Add Row" id="cb1"
                                  actionListener="#{bindings.CreateInsert.execute}"/>
           <af:commandButton actionListener="#{bindings.Commit.execute}"
                                  text="Commit" id="cb2"/>
           <af:commandButton actionListener="#{bindings.Rollback.execute}"
                                  text="Undo" immediate="true" id="cb3">
              <af:resetActionListener/>
           </af:commandButton>
         </af:panelGroupLayout>
      </f:facet>
      <f:facet name="center">
         <af:table value="#{bindings.DepartmentsView1.collectionModel}"
                     var="row" rows="#{bindings.DepartmentsView1.rangeSize}"
                     emptyText="#{bindings.DepartmentsView1.viewable ? 'No data to display.' : 'Access Denied.'}"
                     fetchSize="#{bindings.DepartmentsView1.rangeSize}"
                     rowBandingInterval="0"
                     selectedRowKeys="#{bindings.DepartmentsView1.collectionModel.selectedRow}"
                     selectionListener="#{bindings.DepartmentsView1.collectionModel.makeCurrent}"
                     rowSelection="single" id="t1" partialTriggers="::cb1">
           <af:column sortProperty="DepartmentId" sortable="false"
                         headerText="#{bindings.DepartmentsView1.hints.DepartmentId.label}"
                         id="c4">
              <af:inputText value="#{row.bindings.DepartmentId.inputValue}"
                               label="#{bindings.DepartmentsView1.hints.DepartmentId.label}"
                               required="#{bindings.DepartmentsView1.hints.DepartmentId.mandatory}"
                               columns="#{bindings.DepartmentsView1.hints.DepartmentId.displayWidth}"
                               maximumLength="#{bindings.DepartmentsView1.hints.DepartmentId.precision}"
                               shortDesc="#{bindings.DepartmentsView1.hints.DepartmentId.tooltip}"
                               id="it4">
              </af:inputText>
           </af:column>
           <af:column sortProperty="LocationId" sortable="false"
                         headerText="#{bindings.DepartmentsView1.hints.LocationId.label}"
                         id="c1">
              <af:inputText value="#{row.bindings.LocationId.inputValue}"
                               label="#{bindings.DepartmentsView1.hints.LocationId.label}"
                               required="#{bindings.DepartmentsView1.hints.LocationId.mandatory}"
                               columns="#{bindings.DepartmentsView1.hints.LocationId.displayWidth}"
                               maximumLength="#{bindings.DepartmentsView1.hints.LocationId.precision}"
                               shortDesc="#{bindings.DepartmentsView1.hints.LocationId.tooltip}"
                               id="it2">
              </af:inputText>
           </af:column>
         </af:table>
      </f:facet>
      <f:facet name="start"/>
      <f:facet name="end"/>
      <f:facet name="top"/>
    </af:panelStretchLayout>But I notice that when I clicked the createinsert button, the new row is appended at the top of the table.
    I then tried to click the last row, but when I click the CreateInsert, it is appended before the last row.
    How can I configure this so that it will show at the last row?
    Thanks.
    JDEV 11G PS 3

    Ramandeep Nanda wrote:
    * Insert new Rows at the end of RowSet.
    * @param row
    @Override
    public void insertRow(Row row) {
    //go to the end of Rowset if it has rows
    Row lastRow = this.last();
    if (lastRow != null) {
    //insert new row at the end and make it current
    int indx = this.getRangeIndexOf(lastRow) + 1;
    this.insertRowAtRangeIndex(indx, row);
    this.setCurrentRow(row);
    } else { // empty Rowset
    super.insertRow(row);
    }     The row will be added at the end. You actually override this method in your voImpl.Works like a charm..
    Thanks Ramandeep..learned something new today...

  • How to make a new row as selected in adf table

    Hi,
    I am adding a new row to my table as below.
    DCBindingContainer bindingContainer =
    (DCBindingContainer)ADFUtil.evaluateEL("#{bindings}");
    DCIteratorBinding iter = bindingContainer.findIteratorBinding("IfwSystemBrandView1Iterator");
    ViewObject vo = iter.getViewObject();
    row = vo.createRow();
    row.setNewRowState(Row.STATUS_INITIALIZED);
    vo.insertRow(row);
    This code is adding a new row at the end of the table.
    I want this new row to be selected after it gets added.
    How to achieve this??
    Thanks,
    Praveen

    You should mention your JDev version!!!!
    in 11g you can archive this like
    BindingContext bctx = BindingContext.getCurrentInstance();
    BindingContainer bindings = bctx.getCurrentBindingEntry()
    DCIteratorBinding dcIterator =
    (DCIteratorBinding) bindings.get("IteratorBindingName");
    Row rw = dcIteratorBinding.getRowSetIterator().createRow();
    rw.setNewRowState(Row.STATUS_INITIALIZED);
    //insert row to iterator
    dcIteratorBinding.getRowSetIterator().insertRow(rw);
    //make new row the current
    dcIteratorBinding.setCurrentRowWithKey(
    rw.getKey().toStringFormat(true));or better if you have access to the table (
    private void createRowInTable(RichTable table){
    CollectionModel model = (CollectionModel ) table.getValue();
    JUCtrlHierBinding _binding = (JUCtrlHierBinding) model.getWrappedData();
    DCIteratorBinding dcIteratorBinding= _binding.getDCIteratorBinding();
    Row rw = dcIteratorBinding.getRowSetIterator().createRow();
    rw.setNewRowState(Row.STATUS_INITIALIZED);
    //insert row to iterator
    dcIteratorBinding.getRowSetIterator().insertRow(rw);
    //make new row the current
    Key k = rw.getKey();
    dcIteratorBinding.setCurrentRowWithKey(k.toStringFormat(true));
    }Timo

Maybe you are looking for