OnClientRowSelection for tableView's

Hi,
I'm working on a portal application which utalises epcf eventing to allow an iView to send messages another iView. Basically a table is displayed in the left iView and, depending which row the user selects, a message containing data from the selected row is sent to the right iView.
I initialy tried to utalise the onClientRowSelection('javascript') feature of the tableView htmlb element (with selectionMode="SINGLESELECT") which is supposed to invoke a javascrip function whose name is supplied as a parameter. However, after spending some time fudging trying to get it working, I was eventually took another route and turned one of the cells into a link.
I was wondering whether anyone else has had any experience using onClientRowSelection and were successful in calling some javascript.

Hi Sergio,
> Thinking that the setOnClientRowSelection would
> invoke the onRowSelect function in the javascript.
The event object exists, it's not passed, see below.
> how to pass data from the selected row
> to <objectData>?
<%@ taglib uri="tagLib" prefix="hbj" %>
<jsp:useBean id="model" scope="application" class="com.sapportals.htmlb.table.DefaultTableViewModel" />
<%@ page import="com.sapportals.htmlb.TreeNode"%>
<hbj:content id="contentID" >
  <hbj:page title="pageTitle">
    <hbj:form id="formID" >
      <hbj:tableView
        id="myTableView"
        selectionMode="SINGLESELECT"
        model="model"
      >
        <% myTableView.setOnClientRowSelection("showUpTableContent()"); %>
        <% myTableView.setJsObjectNeeded(true); %>
      </hbj:tableView>
    </hbj:form>
  </hbj:page>
  <script language='JavaScript'>
  function showUpTableContent(){
    alert('it was a row ' + htmlbevent.obj.getClickedRow());
  </script>
</hbj:content>
See https://forums.sdn.sap.com/thread.jspa?threadID=26395 for methods which exist on HTMLB TableView JS object. To retrieve a certain value, set the key column in your table.
Hope it helps
Detlev

Similar Messages

  • Writting Events for TableView Buttons

    Hi SDN,
    I created a table view in a jsp dynpage which has one of the columns type as button.i got it by using "setColumnType" attribute of tableview.
    now i want to fire server and client events onclick of those buttons.how to achieve it? can we write client and server events for those buttons as like normal buttons.
    if yes tell me how and where to write?
    explain me with example (coding) if possible.
    Thanks & Regards,
    Art.
    /points will be rewarded/

    Hi Subathra,
    Thank you for ur reply.i know that we can achieve it using "setOnCellClick " but i want to know whether we can use the normal attributes of a button for this button placed in a cell of a tableview.
    if yes how to use it.is there any relation between cell renderer attribute and my requirement.
    <b><u>Note:</u></b>
    you can share ur ideas about other components also which can be used in a tableview (inputfield,link,image...) and writting events for those components.
    Thanks & Regards,
    Art

  • Tip needed for an excel-type grid for TableView

    Hi,
    I am looking for a tip on how to implement a excel like grid where row numbers are always displayed on the left (part of the margin, not as a column).
    Thx
    T

    I believe the best way to implement this would require this feature (Tableview with rows headers TableView row headers).
    It is linked to a bug with private permission (http://javafx-jira.kenai.com/browse/RT-8829) so you can't vote on it, and is not scheduled for any release currently.
    So, lacking that feature, you may have to do something clever, such as create two columns next to each other in a vbox, one containing column headers and data and another containing just the row numbers, then keep all of it in synch so that scrolling the main table will also scroll the row header table and ensure the height of the rows in the two table are kept in synch. There are probably other methods to achieve this, but this was the idea off the top of my head.

  • Retaining value for tableView element

    Hi,
    I have a tableView element on a BSP page. visibleRowCount property for it is set to 10.
    Source internal table for this tableView is lt_search declared on the page attributes tab.
    I am able to successully show data in this tableView element.
    But when the next page button is clicked on this tableView element to view the next 10 rows,
    It seems that the source internal table for this tableView element (lt_search in this case) gets cleared,
    and I have to re-populate it again in the event OnInputProcessing.
    Which means I have to execute the select statement everytime next or preivous page button on the tableView element is clicked.
    Is this the way it should be, or there is a way to retain the value of internal table and hence the tableView element and avoid executing selecte every time..
    Thanks in advace,
    CD

    hello,
    Is it a stateless OR statefull application?
    If it is stateless then not possible....
    Thanks

  • Some attributes not working for tableView.

    Hi All,
    Below is the code of my tableView:
    <htmlb:tableView id              = "material"
                                     headerText      = "Materials"
                                     headerVisible   = "true"
                                     design          = "alternating"
                               filterButtonTooltip   = "Use this row to filter and find materials"
                               filterButtonText      = "Filter"
                                     visibleRowCount = "5"
                                     fillUpEmptyRows = "true"
                                     onRowSelection  = "MyEventRowSelection"
                                     selectionMode   = "MULTILINEEDIT"
                                     width           = "950"
                                     filter          = "SERVER"
                                     emptyTableText  = "No items found for specified search criterion"
                                     iterator        = "<%= iterator %>"
                                     table           = "<%= itab_materials %>" />
    But the three attributes filterButtonTooltip  , filterButtonText and  emptyTableText does not seem to work.
    No text is displayedif the TV  is empty , neither filterButtonText and filetrButtonTooltip are visible..
    Any ideas?
    Regards,
    Anubhav.
    Edited by: Anubhav Jain on Nov 13, 2008 5:01 AM

    Hi All,
    Solved it..
    DATA: find type string value `src="/sap/public/bc/ur/Design2002/themes/sap_tradeshow/common/saptable/ico12_filter.gif"`,
              replace type string value `src="/sap/public/bc/ur/Design2002/themes/sap_tradeshow/common/saptable/ico12_filter.gif" alt="You can use this row as a filter"`.
    <htmlb:gridLayoutCell columnIndex = "1"
                                        rowIndex    = "1" >
                         <bsp:findAndReplace find    = "<%= find %>"
                                            replace  = "<%= replace %>" >
                    <htmlb:tableView id              = "service"
                                     headerText      = "Services"
                                     headerVisible   = "true"
                                     design          = "alternating"
                                     visibleRowCount = "5"
                                     fillUpEmptyRows = "true"
                                     onRowSelection  = "MyEventRowSelection"
                                     selectionMode   = "MULTILINEEDIT"
                                     width           = "950"
                                     filter          = "SERVER"
                                     iterator        = "<%= iterator %>"
                                     table           = "<%= gt_materials %>" />
    </bsp:findAndReplace>
                  </htmlb:gridLayoutCell>
    Regards,
    Anubhav
    Edited by: Anubhav Jain on Jan 23, 2009 11:52 AM

  • Set the table's width for TableView

    I am creating a new TableView with few columns and I am trying to set the width for the entire table. I searched the API but it only gives me setMaxWidth. I tried but, it didn't work. Can anyone suggest me how to set the tables width.
    I am doing this:
    private TableView<XYZ> table = new TableView<XYZ>();
    table.setMaxWidth(600);
    table.setLayoutX(15);
    table.resize(40, 40);
    But nothing really changed the entire table's width.
    thanks.

    Column resize policy is what you are looking for.

  • Checkbox for TableView

    Hi all,
    I need to place a checkbox as a column in each line item of an item list. Was planning to making it to a value attribute as it has no underlying attribute to map to it. However, how do i retrieve whether the checkbox has been checked or not.
    Kindly share any links/blogs that explain more about placing checkboxes in IC.
    Thanks in advance.
    Nisha

    steps for creating the class.
    go to transaction SE24 enter a name and click create , and hit enter on the popup, then hit save in the next pop up (without changing any default values)
    now click on the interfaces tab and enter "IF_HTMLB_TABLEVIEW_ITERATOR" in interface column.
    now click on methods tab.
    place the cursor on IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START method and click on the code button (third from left).
    in this place you can enter the code.
    for example if you want column name "ABC" as check box.
    CASE p_column_key.
        WHEN 'ABC'.
          DATA: li_checkbox    TYPE REF TO   cl_htmlb_checkbox.
          CREATE OBJECT li_checkbox.
          li_checkbox->id        = p_cell_id .
         li_checkbox->checked   = m_row_ref->invisible.
          p_replacement_bee      = li_checkbox.
    endcase .
    now in the oninitializationevent of your page enter the following code
    my_iterator should be declared in page attribute with type ref to IF_HTMLB_TABLEVIEW_ITERATOR
    CREATE OBJECT my_iterator TYPE <your iterator class> .
    and in the layout section.
    <htmlb:tableView id            = "tv1"
                               selectionMode = "NONE"
                               width         = "100%"
                               table         = "<%= itab %>"
                               iterator      = "<%= my_iterator %>" />
    this is all you need for the iterator to work for your case.
    Hope this is clear.
    Regards
    Raja

  • SetCellFactory for TableView's header row.

    I was trying to implement a CheckAll Button for the TableView. Previously, I was able to create a column of checkboxes by using setCellFactory but now I needed to do the same with the header but I can't seem to find anything about the TableView's header. I remembered that I was able get the header object from the table itself back when I was using Swing. Does JavaFX 2.0 have any API function to do with the header?

    There is no API in TableColumn yet to support accessing the header rendering, but it is intended for a future release.
    Of course, with a little bit of hackery via the lookup method, you can probably find what you want and manually modify it - but this isn't for the faint of heart.
    -- Jonathan

  • Best place for tableview scrollToRowAtIndexPath?

    Hi, wondering what the right place is to put a call to scroll a tableview to a specified section/row, but only when an app first starts up. I have a subclass of UITableViewController, and I load my data in viewDidLoad. Adding a call to scrollToRowAtIndexPath in viewDidLoad bombs (naturally). I added a boolean to the controller to track whether I need to scroll, and successfully added the scroll code into viewDidAppear, flipping the boolean to prevent it from happening again the app's lifespan...but is that the right place to put it? Seems a bit clunky.
    Here's the code:
    - (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    if (!started) {
    started = YES;
    NSIndexPath *scrollIndexPath = [NSIndexPath indexPathForRow:row inSection:section];
    [self.tableView scrollToRowAtIndexPath:scrollIndexPath atScrollPosition:UITableViewScrollPositionTop animated:NO];
    BTW, how do I post code so it looks good?
    Thanks!

    how about viewWillAppear?
    Put your code in Squiggly brackets starting and ending with { code } (no spaces)
    //code example

  • Can't fill input fields for TableView - HELP!!!!

    Hi,
    I know this is probably a stupid question, but...
    I've created a value node and bound it to a table making all of the entries "InputField."  When I change the value and click into other cells, the original values re-appear!
    What am I doing wrong?  What I want to do is be able to change any cell, insert new rows.  When I'm done, I will press the Save button and process all my values.
    Any ideas?
    Thanks,
    Andrew

    Hi Valery,
    Thanks for looking at this.  You seem to be the one that answers most of the problems I've been searching for!  Being new to this but with an OO background, your understanding of the Dynpro tool has been invaluable to me so far.
    <b>
    Context  (TimeEntryView)
    -TimesheetTable (Model node)
    -InputTimesheetTable (Value node 0..n, singleton=true
      -employeenumber
      -activity
      -MondayHours
      -TuesdayHours
      - etc.
    </b>
    ====================
    InputTimesheetTable is a root node that is populated by an adhoc method.  Secondly, this node was created in a view and not the controller. 
    So, in the init of the controller, I get the persons PersonnelNumber and execute the bapi to retrieve their records.  I trigger an event, to which the TimeEntry view has subscribed, and the Event Handler method in TimeEntry view in turn calls executePopulateTable method which populates nodeInputTimesheetTable by iterating through nodeTimesheetTable.
    When reading further, and in retrospect, I think it might be best to keep all this functionality in the controller instead of the view.  Also, for future enhancements, it may be best to create a Controller Value node that could be used for all employees for a specified manager and underneath these nodes have the InputTimesheetTable node for that particular employee.
    <b>
    Context (Controller)
    ->EmployeeTimesheet  (Value node - 0..n singleton=true)
        -EmployeeNumber  (Value attribute)
        -InputTimesheetTable (Value node - 1..1, singleton=false)
           - Activity
           - MondayHours
           - TuesdayHours
           - Etc.
    </b>
    I could then use the supply function for the InputTimesheetTable passing the employeeNumber from it's parent node.
    Do you think this is the best approach?  I'm open to suggestions.  If it makes sense to rewrite this portion, I only want to do it once!
    Thanks,
    Andrew

  • Modify hbj:tableView with JavaScript

    Hi forum-team,
    does anyone know if it is possible to modify the contents of a hbj:tableView-Cell with JavaScript (e.g. modify the text within a cell)?
    I only found some getClickedRow methods within the JavaScript API.
    Regards,
    Frank

    Hi,
      I can't get a code for this but can guide you.
    There is onClientCellClick event for tableview which can be used for this. You will have to implement separate methods for each cell click, I hope. Also this is a classlib and not taglib. Check the documentation for more info on this.
    http://help.sap.com/saphelp_nw70/helpdata/en/fd/01f34026d70b06e10000000a155106/frameset.htm
    Also check these.
    onClientRowSelection for tableView's
    onClientCellClick in htmlb tableview
    Regards,
    Harini S

  • TableView OnClientRowSelection Question

    Hi All,
    I implemented OnClientRowSelection for my tableview, however, the problem I have now is that after the javascript executes, the actual row selection does not take place.
    So, when I click on the row selection rectangle, my javascript works well, but then the processing stops and the row remains visually unselected.
    Do you know if there is a way to get around that?
    Thanks!
    Roman D.

    Hi,
    No need to use Client Row selection/triggering a JS in your case. You have an attribute: <b>p_edit_mode</b> which will be initial if that row is not initial. Using that you can display/hide the drop down list box. Try this code:
    method IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START.
      CASE p_column_key.
         WHEN 'MATNR'.
          IF p_edit_mode IS NOT INITIAL.
            DATA: mat_help_row type IHTTPNVP.
            mat_help_row-NAME = '1316'     .
            mat_help_row-VALUE = '1316-LEOCITRAZINE-WM'.
            append mat_help_row to mat_help.
            mat_help_row-NAME = '1276'     .
            mat_help_row-VALUE = '1276-VALDECOXIB'.
            append mat_help_row to mat_help.
            get reference of mat_help into M_MAT_REF.
            p_replacement_bee = CL_HTMLB_DROPDOWNLISTBOX=>FACTORY(
                                  id                =  p_cell_id
                                  selection         = m_row_ref->MATNR
                                  table             = me->m_mat_ref
                                  nameOfKeyColumn   = 'NAME'
                                  nameOfValueColumn = 'VALUE'  ).
      ENDIF.
    ENDCASE.
    endmethod.
    Hope this helps,
    Regards,
    Ravikiran.

  • TableView - support for datasource (on-demand loading and JDBC)

    Hi,
    I'm new to JavaFX and I was wondering if anybody knows any good practices for TableView with large datasets. Any API extension that supports datasources for on-demand loading and JDBC. Or any good tutorial, example or ideas. I was looking at DataFX but I don't see any datasource for JDBC in the javadocs even when it's mention their website.
    Thanks in advance, any help or ideas are appreciated.

    Hello,
    here is some pseudocode for your requirement.
    max pagesize is 100 per query request
    i=0
    While(!Lastpage)
    request.startrownum=i;
    response=LeadQuery(request);
    Lastpage=response.lastpage;
    i+=100
    }

  • How to get the TableRow from TableView with given row Index.

    Hi ,
    I want to retrieve the TableRow object or Cells of that row of the TableView, for the given row index. How i can get that.
    Here is the below code what i am actually looking for
    TableView table = new TableView();
    table.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
         @Override
         public void changed(ObservableValue<? extends Number> paramObservableValue,Number prevRowIndex, Number currentRowIndex) {
              System.out.println(":::::::::>  Previous Row : "+prevRowIndex+" Current Row : "+currentRowIndex);
              if(prevRowIndex.intValue()>-1){
                   // TODO: Get the TableRow object of prevRowIndex or the cells in that row.
    });Thanks in advance !!

    Jonathan, Thanks for the info !
    Actually my requirement is ,
    1) I have an editable table with four columns. Where the first three colums are editable and the last column is a delete button to delete the record.
    2) My requirement is such that, whenever the user edits a cell, it is not comitted on focus out but the whole row(all cells) is comitted at a time when the user hits "enter". If the validation is not successfull, the textfields are styled with error class and focuses on it.
    So based on the key event on the textfield in the editable cell, i am fetching all the cells in the same row, with the below code.. and doing the save/update operation.
    textBox.setOnKeyReleased(new EventHandler<KeyEvent>() {
         @Override
         public void handle(KeyEvent t) {
              if (t.getCode() == KeyCode.ENTER) {
                          TableRowSkin<ContactPersonResponse> rowSkin = (TableRowSkin<ContactPersonResponse>) cell.getParent();
                    ObservableList<Node> cells = rowSkin.getChildren();
                    view.setCellAction(cells);
                          // The setCellAction(cells) will iterate through all the cells, validates the text field,
                          // if validation is success commits all the cells else styles the cells and focuses on the cell.
    });Till now everything is fine and working properly.
    Now I have new requirement that when the user edits a row (not yet comitted) and if he selects another row, the previous selected row should be automatically committed with validation.
    So my final action is to call the setCellAction(cells) by passing the cells of the previous selected row.
    table.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
         @Override
         public void changed(ObservableValue<? extends Number> paramObservableValue,Number prevRowIndex, Number currentRowIndex) {
              System.out.println(":::::::::>  Previous Row : "+prevRowIndex+" Current Row : "+currentRowIndex);
              if(prevRowIndex.intValue()>-1){
                   // TODO: Need to call the setCellAction method by passing the cells of previous selected row. (prevRowIndex)
                            // Here i am not getting how to get the cells of the previous row.          
    });In the selectedIndex listener , i am not getting how to get the cells/row from the index.
    Any solution or workaround for achieving this functionality is highly apprieciated .
    Thanks & Regards,
    Sai Pradeep Dandem.
    Edited by: Sai Pradeep Dandem on Jan 2, 2012 10:23 PM
    Edited by: Sai Pradeep Dandem on Jan 2, 2012 10:23 PM

  • Problem on refreshing tableview's content

    Hi everyone!
    I'm developing a program using BSP and MVC based on tutorial_4_mvc.
    The program functions is basically insert, update and delete records on a transparent table using a tableview element.
    I defined tableview using the following parameters:
    <htmlb:tableView id              = "result"
                     design          = "ALTERNATING"
                     headerText      = "Header Text"
                     footerVisible   = "TRUE"
                     onRowSelection = "onRowSelection"
                     table           = "<%= t_dados_table %>"
                     visibleRowCount = "3" >
    For tableview collums, I used the following parameters:
      <htmlb:tableViewColumns>
        <htmlb:tableViewColumn columnName          = "APROGRUP"
                               width               = "100"
                               horizontalAlignment = "left"
                               title               = "Grupo de Aprovação de Programa"
                               type                = "input" >
        </htmlb:tableViewColumn>
        <htmlb:tableViewColumn columnName          = "DSCEN"
                               width               = "100"
                               horizontalAlignment = "left"
                               title               = "Descrição"
                               type                = "input" >
        </htmlb:tableViewColumn>
        <htmlb:tableViewColumn columnName          = "delete"
                               horizontalAlignment = "center"
                               title               = "Delete Item"
                               type                = "button"
                               onCellClick         = "delete" >
        </htmlb:tableViewColumn>
      </htmlb:tableViewColumns>
    The insert and update functions works just fine. So as the first time I search for a record and fill the tableview with the results. But the real problem is:
    The first time I fill the tableview, it works just fine! But when I try to search for a second code or when I have to delete a tableview's record I can't display the correct information.
    Example:
    1     1
    2     2
    3     3
    When I delete the "1   1" record on the tableview, it returns displaying:
    1    1
    2    2
    and seems like I've deleted the wrong record, but looking at the transparent table, the result is:
    2    2
    3    3
    This means that the logic for delete is correct and it's working no problem.
    BUT the tableview is displaying the wrong data.
    Anyone has been in a similar situation?

    Hi Hoffmann,
    my server cache is already set to "0". The browser cache has the same value. I tried to overwrite de value on this two fields and activate again, but the problem remains.
    There is any chance of this problem be a simple configuration mistake?
    When I change the type from "INPUT" to "TEXT" on the tableViewColumn property all the functions works just fine!
    But when I try to use the "INPUT" statement, the fields came with the old value, and the only way to update them is reloading the tableview element using an empty internal table and then reloading again with the filled internal table.
    For now, I'm using this way, but must be another way.

Maybe you are looking for

  • PR to PO lead time

    Hi All Is there any standard report to find PR to PO lead time. Formula to find PR to PO lead time = PO creation date - PR release date Regards Satish Kumar

  • My Mac Pro 1,1 keeps freezing and crashing

    This happens regularly. Everytime I start up a game or try to watch a video I am forced to restart. This is the error report upon restarting: Interval Since Last Panic Report:  41183 sec Panics Since Last Report:          2 Anonymous UUID:           

  • Backup to two computers?

    I generally SYnc my iPhone with my iMac. I am going to be away for quite a while, and while away, my new iPhone 4 will be arriving and I will want to use my MacBookPro to activate the new phone, and to have everything transferred from i Phone 3 to 4.

  • Import in Crystal Report

    So... und nun gleicht das nächste Problem, da wollte ich mir die Crystal Report Samples einverleiben und benutzen, die hier netterweise von Hilko Müller zur Verfügung gestellt wurden. Habe auch brav gedownloadet und entpackt und dann dies... ... Die

  • Newbie needs JNI help

    the JNI tutorial speaks about creating a "shared directory" where a "dll" file is created and stored. How do i create this ".dll" file and store it into the shared directory ? ...