Htmldb_item date_popup populating wrong row

Hi guys, I've noticed a few similar threads previously posted on the forums about this issue, unfortunately mines occurring in APEX 2.2.
When I try to populate a date pop_up field it populates the wrong field. I want to be able to order my report results A-Z based on project names but using an order by at the end of the query then causes the population error to occur. I've spent a while beating my brain against this yet to no avail, was wondering if anyone could give me a hand.
Code:
select
pr.proj_name,
HTMLDB_ITEM.DATE_POPUP(4,rownum,
pr.planned_imp_date, 'DD-MON-YYYY HH24:MI', 20, NULL) PLANNED_IMP_DATE,
pr.STATUS
from projects pr
where pr.proj_id = :p9_project_id
order by pr.proj_name;
Thanks,
Ruari

Have had a hack away at it and came up with the following, all works fine for me so I hope it's useful for someone else.
select x.proj_name
, x.status
, HTMLDB_ITEM.DATE_POPUP(4,rownum,x.planned_imp_date, 'DD-MON-YYYY HH24:MI', 20, NULL, x.proj_name) PLANNED_IMP_DATE
FROM (select pr.proj_name proj_name,
pr.STATUS status
,pr.planned_imp_date planned_imp_date
from projects pr
where pr.project_id = :p9_project_id
order by pr.proj_name) x
Edited by: Ruari on Oct 6, 2008 10:49 AM

Similar Messages

  • HTMLDB_ITEM.date_popup on single row report does not work

    Dear HTML DB Team,
    On a report wit a single( one ) row the "HTMLDB_ITEM.date_popup" does not fill the selected date to the cell. (Same for wwv_flow_item.date_popup)
    On the same report with 2 or more rows HTMLDB_ITEM.date_popup works fine.
    Any suggestions?
    Erik
    testcase:
    create region:
    select htmldb_item.hidden(1,empno) empno,
    ename,
    htmldb_item.select_list_from_query(3,job,'select distinct job, job from emp') job,
    htmldb_item.popupkey_from_query(4,mgr,'select ename, empno from emp',10) mgr,
    wwv_flow_item.date_popup(6,null,hiredate) hiredate,
    htmldb_item.text(7,sal,10) sal,
    htmldb_item.text(8,comm,10) comm,
    htmldb_item.select_list_from_query(9,deptno,'select dname, deptno from dept') deptno
    from emp
    delete 13 rows from emp ( 1 row left ):
    delete from emp
    where ename <> 'KING';
    => date_pop does not work

    Using the htmldb_item API vs. built-in multi-row update functionality:
    I can't speak to the question about the date for the next HTML DB release. But I'd like to add a few comments to this discussion regarding the use of the htmldb_item API package. It is generally advisable to use the built-in multi-row update functionality instead of htmldb_item function calls when implementing tabular forms. While I do acknowledge that some display types such as date popups are not yet available, I would nevertheless recommend working with what's available on the report column attributes page (i.e. using a text field for the date columns) as opposed to using htmldb_item functions whenever possible. Please keep in mind though that they are mutually exclusive, so they can't be combined on the same report.
    The reasons for my recommendation are simple: first of all, if you use htmldb_item calls as part of your SQL statement, the HTML form elements are rendered for all rows in your result set. The built-in types on the other hand only render HTML form elements for those rows shown on your current page, thus you get better performance. Secondly, htmldb_item calls make your SQL statement quite complicated, not only has the engine to jump back and forth between executing your SQL and calling the PL/SQL functions, you also need to take extra care implementing your PL/SQL processes according to the item IDs you assigned in your htmldb_item function calls. When working with e.g. popup LOVs, this gets even more complicated because that type actually results into two html form elements for each column (one storing the hidden ID, one storing the display value). And lastly, by using the multi-row update functionality, you would get lost update detection automatically built. That means, that you can't accidentally overwrite another person's changes in the event that you should both be working on the same data. Implementing this kind of functionality with your htmldb_item based tabular forms would take a lot more effort than simply go with what's already provided.
    So please carefully weigh the benefits of additional display types that you'll get by using the htmldb_item API against all the functionality you'll get by using the built-in tabular form and multi-row update features.
    Regards,
    Marc

  • Date_popup returning value to wrong row

    I have looked at the thread below and still cannot get my code to work
    Re: prevent certain rows in updateable report from being updated??
    I have a tabular form that is used for a mass approval system for managers. In this tabular form the managers are allowed to change 2 fields...that status field which is a static lov and the approval date field. The approval date field will always be null when the user comes into the form so we have this field set automatically to the sysdate. The problem we are encountering is that when we change the date field to something other than sysdate the system will send the new date from the date picker to a different row. I found the thread above and tried to implement it in my code but it is still returning the data to the wrong row. I was trying to decipher the code and wasn't really sure about it so I thought I would put my code here in hopes that someone could help me. (NOTE - I don't really need the decode statement for the date_popup but if I didn't have it I would get an error so the first part of my decode statement shouldn't ever be hit cause we don't have an approval status of P.
    Query Code
    select
    HTMLDB_ITEM.HIDDEN(1,EVAL."EVAL_ID") EVAL,
    EVAL."EVAL_ID" EVAL_ID_DISPLAY,
    HTMLDB_ITEM.SELECT_LIST(2,nvl(EVAL.APPROVE_MID,'Y'),'Approve;Y,Deny;N') MID_STATUS,
    EVAL."EMP_ID",
    EVAL."MID_BEHAVIOR_TOT_AVG",
    EVAL."MID_PERF_TOT_AVG",
    EVAL."FNAME" || ' ' || EVAL."LNAME" NAME,
    EVAL."LOCK_FLAG_MID",
    NVL(EVAL."SUPERVISOR_NAME", ' ') SUPERVISOR,
    decode(EVAL.APPROVE_MID,'p',htmldb_item.text(3,to_char(eval.approve_mid_date,'dd-mon-yyyy'),null,null,'onfocus=this.blur()')||substr(htmldb_item.date_popup(3),1,0),htmldb_item.date_popup(3,NULL,NVL(eval.approve_mid_date,SYSDATE),'dd-mon-yyyy')) mid_date
    from "#OWNER#"."EVAL", "#OWNER#"."EMPLOYEE", "#OWNER#"."TEMP_EMP"
    WHERE EMPLOYEE."SUPERVISOR" = (SELECT POS_NUM FROM EMPLOYEE WHERE TEMP_EMP.CENUM = :APP_USER AND EMP_ID = TEMP_EMP.EMP_ID) AND EMPLOYEE.EMP_ID = EVAL.EMP_ID
    Custom Submit Code
    for i in 1..htmldb_application.g_f01.count
    loop
    update eval
    set approve_mid = htmldb_application.g_f02(i)
    where eval.eval_id = htmldb_application.g_f01(i);
    commit;
    IF :P72_DATE_OVERRIDE IS NULL THEN
    update eval
    set approve_mid_dATE = htmldb_application.g_f03(i)
    where eval.eval_id = htmldb_application.g_f01(i);
    commit;
    ELSE
    update eval
    set approve_mid_date = :P72_DATE_OVERRIDE
    where eval.eval_id = htmldb_application.g_f01(i);
    end if;
    commit;
    end loop;
    HELP PLEASE!!!!!
    Thanks,
    Amber

    mtuser,
    you have to be a little bit more patient, your initial postings was just a few hours ago.
    About your problem, have a look at Re: prevent certain rows in updateable report from being updated??
    I think it explains your problem and offers a solution for it.
    Patrick
    My APEX Blog: http://inside-apex.blogspot.com
    The ApexLib Framework: http://apexlib.sourceforge.net
    The APEX Builder Plugin: http://sourceforge.net/projects/apexplugin/

  • POPUPKEY_FROM_QUERY returning value to wrong row

    Hi,
    I'm running Apex 3.0.1. I have a tabular report that I'm trying to add a popup from query that returns the key/code value (instead of the display value).
    I can call the pop-up okay, but it's returning the value to the wrong table row. I can see in the naming of the Javascript functions that it's looking at the wrong row. For example, here are 4 rows in display order and the names of the Javascript function calls:
    1. javascript:genList0_f15_1()
    2. javascript:genList0_f15_3()
    3. javascript:genList0_f15_2()
    4. javascript:genList0_f15_0()
    I can see in the function call that it's passing an index that doesn't match the displayed row number here:
    "&p_element_index=" +  escape ('1') + So if I click on the LOV icon for row 1 and select one of the LOV values, it will return the value to the second displayed row (zero-based index).
    I've read here of some issues with not having all rows make the call (e.g. in this post from Patrick Wolf date_popup returning value to wrong row but all my rows have values.
    The tabular report allows sorting by column headers, which I would guess is (at least part of) what's messing the function numbering? The query generates the rows, including the function calls, but the report displays in a different order?
    Any suggestions would be greatly appreciated.
    Thanks,
    Stew
    Good luck,
    Stew
    My Oracle Community blog: http://www.oraclecommunity.net/profiles/blog/list?user=stewstryker

    Christina,
    You hit the nail on the head! The tabular form region was defined as SQL Query - without the Updateable part! I'm not sure why I didn't have it that way from the start...
    Now I just have to find and implement the Javascript that will copy the updated value that's returned by the LOV to the correct column (defined as apex_item.text). That was the only way I could figure how to allow the user to enter a value directly or select from a LOV. Clumsy but functional I believe!
    Thanks to you and Scott for the tips.
    Stew

  • HTMLDB_ITEM.DATE_POPUP API

    hi!! I have a report (sql query type Region) and one of the columns is generated
    dynamically through HTMLDB_ITEM.DATE_POPUP API. One of the parameters of this function
    is the ROW, so I had to pass to this function as the row parameter the ROWNUM, like
    this: select (15,rownum,t.call_back_later_date,'dd-mon-yyyy',6,20) from .....
    It worked ok when I have more than one record, but when I have only one record it doesn't work, I mean I select
    the date form the calendar and it's not returned on the corresponding column. Is this a bug when we have one
    record?
    Thanks!

    Daniela,
    I'm assuming this is in Internet Explorer? This was a bug that has been corrected in HTML DB 1.6.
    Joel

  • Htmldb_item.date_popup not functioning correctly since 3.1 upgrade

    If I pick a date from the 6th row (for example) in the table, it is putting the date in the 1st row. The upgrade has broken production code. What can I do to workaround it? Thank you.
    Here is my query:
    select gl_rpt_item_id, description, act_flag, htmldb_item.hidden(1, gl_rpt_item_id) as item_id,
    htmldb_item.date_popup(6,rownum, decode(client.get_gl_date(:f102_client_centric_id, gl_rpt_item_id),'NULL','',to_char(client.get_gl_date(:f102_client_centric_id, gl_rpt_item_id))),'DD-MON-YYYY',11,11,decode(act_flag,'I','"DISABLED"'))
    new_gl_dt
    from gl_rpt_item where is_clinical = 'Y' and act_flag <> 'I'

    Hello,
    We are working for a generic fix for the patch set, but you can fix this right now by adding an id parameter to your call to htmldb_item.date_popup / APEX_ITEM.DATE_POPUP
    Though it's not in the documentation , an oversight that will be fixed, you can generate an id that overrides the APEX generated id. It is the next parameter after the attributes parameter.
    So you immediate fix is to change your query like this,
    select gl_rpt_item_id, description, act_flag, htmldb_item.hidden(1, gl_rpt_item_id) as item_id,
    htmldb_item.date_popup(6,rownum,date_value,'DD-MON-YYYY',11,11,decode(act_flag,'I','"DISABLED"'),'datepicker_'||rownum)
    new_gl_dt
    from gl_rpt_item where is_clinical = 'Y' and act_flag <> 'I' Notice the call to the popup has 'datepicker_'||rownum added, this will set id for the date picker and it will now be set to datepicker_1 , datepicker_2 and so forth
    Regards,
    Carl
    I took the decode out so you could see the id change easier.

  • Program rfbibl01- VATcode for the account is populated wrongly

    Hi All,
    We are using the standard program rfbibl01 to raise the FI document FB01;
    But within the BDC (IN this Program), VAT code for the account is populated wrongly in to the screen;
    When we have no VAT code for the record, it fills the previous records VAT code instead of space
    Appreciate if you have any idea please
    Thanks
    Iver

    Hello,
    How are you passing the data to the program rfbibl01?  Is it through a Z program and submitting rfbibl01?
    If yes, then in the Z program you might be filling the structure BBKPF and BBSEG.  You have to check if the CLEAR is done in this area.
    Cheers,
    Balaji

  • Htmldb_item.date_popup and sort options in reports

    I use the htmldb_item.date_popup in a report (PLSQL returning SQL). Everything works fine unless I provide the option to sort columns. If I allow a column to be sorted, the date_popup does not return the date to the corresponding field but to another field of the same column. However, the users want to be able to sort the report due to several columns. Can anyone provide a work-around?
    The query is as follows:
    DECLARE
    statement VARCHAR2(32767);
    BEGIN
    statement := '
    select
    htmldb_item.checkbox(47, ID, ''onClick="javascript:doSubmit()"'', :P3_FREISTELLUNG_SELECTED, '':'') as CHECKBOX,
    htmldb_item.hidden(11,ID)||
    htmldb_item.hidden(12,ID_VERTRAG)||
    htmldb_item.date_popup(13,null,VON,''DD.MM.YYYY'',13,10) as BEGINN,
    htmldb_item.date_popup(14,null,BIS,''DD.MM.YYYY'',13,10) as ENDE,
    htmldb_item.date_popup(15,null,ERTEILT,''DD.MM.YYYY'',13,10) as ERTEILT,
    htmldb_item.select_list_from_lov(16,decode(FLAG_CANCELED,null,0,FLAG_CANCELED),''LOV_FREISTELLUNG_NULL'',null,''NO'') as FLAG_CANCELED,
    decode(FLAG_DELETED,1,''direkt gelöscht'',2,''indirekt gelöscht'',''aktiv'') as WERT_DELETED,
    htmldb_item.text(17,BEMERKUNG,20,4000) as BEMERKUNG
    from VERTRAG_FREISTELLUNG where ID_VERTRAG = :P3_KOPF_ID';
    if :P3_FREISTELLUNG_NEU = 2 then
    statement := statement||'
    union all
    select
    null as CHECKBOX,
    htmldb_item.hidden(11,null)||
    htmldb_item.hidden(12,null)||
    htmldb_item.date_popup(13,null,null,''DD.MM.YYYY'',13,10) as BEGINN,
    htmldb_item.date_popup(14,null,null,''DD.MM.YYYY'',13,10) as ENDE,
    htmldb_item.date_popup(15,null,null,''DD.MM.YYYY'',13,10) as ERTEILT,
    null as FLAG_CANCELED,
    null as WERT_DELETED,
    htmldb_item.text(17,null,20,4000) as BEMERKUNG
    from dual';
    end if;
    RETURN statement;
    END;
    PS: I know that the problem already has been discussed in the forum, but I did not find a solution for the problem.

    I have this issue as well with popup_from_query compunded with sorting.
    Wondering if there is any workaround from anyone ?

  • Htmldb_item.DATE_POPUP for a date and minute combination

    Hi All,
    I'm new to apex and I'm having an issue getting the below to work.
    I have this sql which is used to produce a report,
    select
    HTMLDB_ITEM.HIDDEN(1, MV_ID) ||
    htmldb_item.checkbox(2,rownum) "Bulk Update",
    HTMLDB_ITEM.text(3, CI_NAME) "CI Name",
    htmldb_item.DATE_POPUP(4, rownum,to_date(to_char(WINDOW_START,'DD-Mon-YYYY HH24:MI'),'DD-Mon-YYYY HH24:MI')) "Window Start" ,
    htmldb_item.DATE_POPUP(5, rownum, to_date(to_char(WINDOW_END,'DD-Mon-YYYY HH24:MI'),'DD-Mon-YYYY HH24:MI')) "Window End",
    HTMLDB_ITEM.text(6,AUDIT_CHANGE_NO) "Change No", AUDIT_UID,
    to_char(AUDIT_TSTAMP,'DD-Mon-YYYY HH24:MI:SS') AUDIT_STAMP
    from MY_SCHEMA.MAIN_Window;
    The problem is the htmldb_item.DATE_POPUP( command will not allow for minutes and seconds to be modified or even displayed (the date is displayed).
    I have changed the Column Formatting - Number / Date Format to DD-MON-YYYY HH24:MI:SS and it still wont display the time.
    Any assistance would be appreciated.
    Cheers
    Brett

    Hi All,
    Seems it was me overcomplicating things,
    Its working now after I removed the "to_date" and "to_char"
    Cheers

  • OAF: Getting wrong row using setForwardURL

    Hi,
    I have a page (CustomerSearchPG) with a search region and a results region. In my results region I want to select one specific row and take it with me to the next page (CustomerCreatePG). When I press the select button I get rerouted to the right page and all the fields are filled out. HOWEVER I find that it is not the row I selected that is displayed, but the first row in the SearchPG.
    The following code is in my Controller:
    if ("select".equals(pageContext.getParameter(EVENT_PARAM)))
    { // The user has clicked an "select" icon so we want to navigateto the CustomerCreatePG.
    pageContext.setForwardURL("OA.jsp?page=/xxcu/oracle/apps/ar/customer/webui/CustomerCreatePG",
    null,
    OAWebBeanConstants.KEEP_MENU_CONTEXT,
    null,
    null,
    true, // Retain AM
    OAWebBeanConstants.ADD_BREAD_CRUMB_NO, // Do not display breadcrumbs
    OAWebBeanConstants.IGNORE_MESSAGES);
    Does anyone have an idea why I get the wrong row, and how I can make the right row appear?
    Regards Roy
    Edited by: JaddaMasa on 18.sep.2009 02:08

    No If you are using the destination URL then there is no need to use the other one.
    The correct destination URL would be like
    OA.jsp?page=/<yourname>/oracle/apps/ak/employee/webui/EmpDetailsPG&employeeNumber={@EmployeeId}
    In the CustomerCreatePG controller [Process Request]
    You can get the row like
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    // Always call this first.
    super.processRequest(pageContext, webBean);
    // Get the employeeNumber parameter from the URL
    String employeeNumber = pageContext.getParameter("employeeNumber");
    Change your code accordinglty.
    Thanks
    --Anil                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • HTMLDB_ITEM.POPUP_FROM_QUERY Populating Previous Text Field

    I have manually created an updateable report from an SQL Query in which I manually index each editable field. I also include some hidden values which I also attempt to control the index values. The rows to be displayed on this page are the result of an adhoc search page (P30). Everything works fine except when I have more than one row returned and try to edit any row other than the first. When I do, the previous row's corresponding field is affected and the last row popup fields can never be changed. My listboxes work fine and appear to be indexed correctly. Am I missing something? Thanks in-advance.
    A condensed version of my SQL:
    select
    NULL "CHECK$01", -- index 01? -- Checkbox for multiple updates is first index
    "TRANSACTION_NUMBER",
    "H_RID", -- index 02?
    "DUTY", -- index 03?
    "IC", -- index 04?
    "IS_NEW", -- index 05?
    "SUBMIT" -- index 06?
    from(
    select
    '0' AS "TRANSACTION_NUMBER", -- to be replaced with dynamic value
    HTMLDB_ITEM.HIDDEN(2,PE||FO) AS "H_RID", -- could hiddens be the problem?
    HTMLDB_ITEM.SELECT_LIST_FROM_QUERY_XL(3,DUTY,'SELECT DUTY||'' - ''||NVL(TITLE,''None Selected'') a, DUTY b FROM PDM.DUTY ORDER BY b') AS "DUTY",
    HTMLDB_ITEM.POPUP_FROM_QUERY(4,IC,'SELECT IC||'' - ''||NVL(TITLE,''None Selected'') a, IC b FROM PDM.INFRA_STRUCTURE ORDER BY b') AS "IC",
    HTMLDB_ITEM.SELECT_LIST(5,'N','Yes;Y,No;N') AS "IS_NEW",
    HTMLDB_ITEM.SELECT_LIST(6,'N','Yes;Y,No;N') AS "SUBMIT",
    HTMLDB_ITEM.MD5_CHECKSUM(duty,ic)
    from fd.pe
    /* Where condition to address previous search page values to determine number of rows to return for editing */
    where (:P30_DUTY = DUTY OR :P30_DUTY IS NULL)

    Scott,
    I had indicated the example was throwing errors associated with the HTMLDB_ITEM.POPUP_FROM_QUERY items. Although this is not the same error I am encountering in version 2.0 it does indicate that either there is an issue with my SQL or a bug with version 3. The SQL used to generate the reports is almost identical to the query I am running on my development site. The table and column names are different and I have provided a "Reader's Digest" version of my actual SQL.
    I can eliminate the LOV errors on this site by replacing the POPUPs with LISTs, but that defeats the point. For efficiency of time, I need to implement POPUPs because the data behind them can potentially result in hundreds of records. Compound this with the number of fields per record which might also employ POPUPs and I could very quickly exceed memory limitations of HTMLDB.
    Again, any assistance would be appreciated. Thanks.
    Ed
    PS. I have edited my SQL for the POPUPs. Apparently, the init LOV errors associated with them were generated by a simple concatenation of data fields within the inner select. I originally had:
    HTMLDB_ITEM.POPUP_FROM_QUERY(4,IC,'SELECT IC||'' - ''||NVL(TITLE,''No Title Available'') as a, IC as b FROM BORG_CUBE.IC ORDER BY b') AS "IC",
    by changing the above to read:
    HTMLDB_ITEM.POPUP_FROM_QUERY(4,IC,'SELECT IC as a, IC as b FROM BORG_CUBE.IC ORDER BY b') AS "IC",
    the init LOV errors went away. Now, there are no errors and no ability to replicate my error for you. Upgrading is not an option at this point, so I will begin recoding. :-(
    Message was edited by: MovingTarget
    MovingTarget

  • ChnAreaDel deleting wrong rows in a string channel

    I am trying to write a script in DIAdem 2010 SP1 to delete the first row of a group that contains two string channels and one time channel, but the
    wrong data is being deleted from the string channels.
    I start with a file that contains a group like this:
    I run this code expecting the first row to be deleted
    Dim logGroup
    Set logGroup = Data.Root.ChannelGroups("Log")
    Call ChnAreaDel(logGroup.Channels("Name"),1,1)
    Call ChnAreaDel(logGroup.Channels("ID"),1,1)
    Call ChnAreaDel(logGroup.Channels("Timestamp"),1,1)
    but end up with this:
    The first row of the Timestamp channel is deleted, but the Name and ID channels get their last rows deleted.
    I have played around a bit and it seems to me that for a string channel ChnAreaDel only deletes from the last row.
    Is there another function I should use? 
    Any help would be appreciated. 
    Thank You,
    Joe
    Solved!
    Go to Solution.

    Hi Joe,
    I've reproduced that ChnAreaDel()  bug you reported in both DIAdem 2010 and 2011-- really odd.  In the meantime, you can use this older approach that uses a string parameter to point to the channel collection to remove the row(s) from:
    Set logGroup = Data.Root.ChannelGroups("Noise data results")
    ChnStr = ""
    FOR Each Channel In logGroup.Channels
    ChnStr = ChnStrAdd(ChnStr, Channel.Properties("Number").Value)
    NEXT
    Call DataBlDel(ChnStr, 1, 1)
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • Populating multiple rows in a table?

    Hi all,
    I hope someone would be able to assist me with this.  Currently, we are supporting a Web Dynpro application that allows a user to query for order data.  In the first view, there is a table with columns order id, order name, customer name, and customer country.  The table allows them to search for more than one order at the same time.
    The problem with this is that the user can only enter order data for one row at a time.  What they want is to be able to cut and paste order ID from some other source and it will automatically populate the table rows.  The users claim that it is inefficient to cut/paste one at a time and would like to change this.
    Does anyone have any suggestions for how to implement this?
    Thanks in advance.

    Hi Charisse,
    you would like to input a set of data with a single paste action?
    From what I understand in web dynpro you can fill just a single ui element at a time. Assuming that you use an Input Element to accept orderd ID, what about filling it with a comma separated list of ID? Then in the action processing you will split the list and use the ID to populate the table.
    Regards

  • Dynamically populating a row repeater

    Hi,
    I have a requirement  wherein in the UI i have to populate a link with a delete icon for each of the selected(multiple via f4) records. This would be 0..n. The row reaptor should have 2 columns. The contents are generated on the fly as and when the records are selected. In the Webdynpro view we jst have a transparent container and a button.
         Can anyone suggest how do we go  about this? [I also tried using a row repeater ui element in the view but it actually repeats the same row :).  ]
    Regards,
    Abhay

    I hope you already created table column with link_to_action UI element as cell editor and created another attribute in the context node which is binded to your table UI element.
    You just need to bind the imageSource property with the newly created context attribute.
    In the event handler of the onSelect of the table.
    get the lead selected element and set the new attribute to value 'ICON_DELETE'
    Abhi

  • Returns wrong row number with ENTER key in JTable...

    I am having a problem to get exact row number ofJTable when ENTER key is pressed.
    table.getSelectedRow() always retuns one more value when ENTER key is pressed(fired). like
    if i have 5 rows in a table and when my focus is on 1st row and then i press enter key focus moves to next row and it returns 1 instead of 0 for the 1st row.
    I have written a code bellow, please check it out and tell me why it happens. Please click on Add Row button for creating rows in table.
    import javax.swing.*;
       import javax.swing.table.*;
       import java.awt.*;
       import java.awt.event.*;
       import java.util.Vector;
       class TableTest extends JFrame {
         MyTableModel myModel;
         JTable table;
         JButton button;
         JButton buttonQuery;
         int count = 0;
         public TableTest() {
           myModel = new MyTableModel();
           table = new JTable(myModel);
           table.setPreferredScrollableViewportSize(new Dimension(500, 200));
           JScrollPane scrollPane = new JScrollPane(table);
          table.addKeyListener(new KeyAdapter(){
              public void keyTyped(KeyEvent ke)
                if(ke.getKeyChar() == ke.VK_ENTER){
                  System.out.println(table.getSelectedRow());
           getContentPane().add(scrollPane, BorderLayout.CENTER);
           getContentPane().add(button = new JButton("Add Row"),
           BorderLayout.SOUTH);
           getContentPane().add(buttonQuery = new JButton("Query"), BorderLayout.NORTH);
           button.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          Object [] aRow = new Object [8];
         String aRow1;
         for (int i=0; i<5; i++) {}
         myModel.addRow(aRow);
       buttonQuery.addActionListener(new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           System.out.println(myModel.getRowCount());
           System.out.println(myModel.getValueAt(1, 3));
       addWindowListener(new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
           System.exit(0);
       class MyTableModel extends AbstractTableModel {
       protected final String[] headers =
       { "No", "Vehicle No", "Date of Loss", "Image Type", "Image Description", "Claim Type", "Scan Date", "User Id" };
       Vector data;
       MyTableModel() {
        data = new Vector();
       public int getColumnCount() {
         return headers.length;
       public int getRowCount() {
        return data.size();
       public Object getValueAt(int row, int col) {
       if (row < data.size() && col < 8) {
         Object [] aRow = (Object []) data.elementAt(row);
       return aRow[col];
       } else {
         return null;
       public void addRow(Object [] aRow) {
         data.addElement(aRow);
        fireTableRowsInserted(data.size()-1, data.size()-1);
       public static void main(String[] args) {
       TableTest frame = new TableTest();
       frame.pack();
       frame.setVisible(true);
       }Regards..
    jaya

    Dear Jaya,
    I have a look at your code. And modified a bit as well to really check the getSelectedRow(). Here's the modified code: I think when key event fired, the table row is changed and then is displays the get selected row. You can check this, if you are on the last row, and you press enter, it displays 0, it means first it changes the row and then displays the selected row which is obviously rowNumber+1.
    Hope it helps.
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.Vector;
    class TableTest
        extends JFrame {
      MyTableModel myModel;
      JTable table;
      JButton button;
      JButton buttonQuery;
      JButton buttonSelectedRow;
      int count = 0;
      public TableTest() {
        myModel = new MyTableModel();
        table = new JTable(myModel);
        table.setPreferredScrollableViewportSize
            (new Dimension(500, 200));
        JScrollPane scrollPane = new JScrollPane(table);
        table.addKeyListener(new KeyAdapter() {
          public void keyTyped(KeyEvent ke) {
            if (ke.getKeyChar() == ke.VK_ENTER) {
              System.out.println(table.getSelectedRow());
        getContentPane().add(scrollPane, BorderLayout.CENTER);
        getContentPane().add(button = new JButton("Add Row"), BorderLayout.SOUTH);
        getContentPane().add(buttonQuery = new JButton("Query"), BorderLayout.NORTH);
        getContentPane().add(buttonSelectedRow = new JButton("Get Selected Row Number"), BorderLayout.NORTH);
        button.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Object[] aRow = new Object[8];
            String
                aRow1;
            for (int i = 0; i < 5; i++) {}
            myModel.addRow(aRow);
        buttonSelectedRow.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            System.out.println("Selected Row is: " + table.getSelectedRow());
        buttonQuery.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            System.out.println(myModel.getRowCount());
            System.out.println(myModel.getValueAt(1, 3));
        addWindowListener(new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
      class MyTableModel
          extends AbstractTableModel {
        protected final String[] headers = {
            "No", "Vehicle No", "Date of Loss", "Image Type", "Image Description",
            "Claim Type", "Scan Date", "User Id"};
        Vector data;
        MyTableModel() {
          data = new Vector();
        public int getColumnCount() {
          return headers.length;
        public int getRowCount() {
          return data.size();
        public Object getValueAt(int row, int col) {
          if (row < data.size() && col < 8) {
            Object[] aRow = (Object[]) data.elementAt(row);
            return aRow[col];
          else {
            return null;
        public void addRow(Object[] aRow) {
          data.addElement(aRow);
          fireTableRowsInserted(data.size() - 1, data.size() - 1);
      public static void main(String[] args) {
        TableTest frame = new TableTest();
        frame.pack();
        frame.setVisible(true);

Maybe you are looking for

  • AS2 Question/Problem..

    I have a swf where I'm calling two external swf files.  These external swf files also load data from an xml file.  The problem is that the first external swf file that I load is the only one that loads.  Well.. the other swf does load, but it loads t

  • Nokia E75 Battery Status Indicator?

    Hello, well i have a problem. on most phones, if you go in the settings, there will be a section where it says all of the phone status. and i find this really useful when it comes to the battery. But on the Nokia E75 i cant seem to find the battery s

  • Black text prints with screen in non PS digital printer

    I'm trying to find a way to print a color CS3 document to our Panasonic DP-C264 so that the black text prints solid black with no screening. It works if I use the PS driver, but some of the finishing options we need aren't available in that driver. T

  • HELP!!  ipod updater doesn't open and give me serevice error

    My daughter and me both have new ipods nano that only worked the first day. The second time I tried to update with new songs from itunes my i pod lost all songs. I've tried EVERYTHING ! reset, restart, reinstall, updates, disk management on windows,

  • Importar proyectos Final Cut y Avid a Premiere 2.0

    El plug-in que se menciona en la página de Adobe, el Automatic Duck Import PPro, ha sido descatalogado, y es el que realizaba esta función. ¿Hay alguna otra solución? Utilizando el Pro Import AE, ¿se podría compatibilizar el proyecto para utilizarlo