Unselect rows in tableview

Hi,
When I select the selected rows in MULTISELECT mode but when i try to clear that by clearing selectedRowIndexTable it is not working.
What should i do ?
Regards,
Manav

HI,
U can try using the following code
LAYOUT
    <htmlb:form>
     <htmlb:tableView id="tab1"
                  table="<%= itab %>"
                 visibleRowCount="8"
                  design="ALTERNATING"
                  footerVisible="TRUE"
                 selectionMode="multiSelect"
                 keepSelectedRow="true" >
     </htmlb:tableView>
<htmlb:button  id = "but1"
               onClick="test"/>
     <%if itab3 is not initial.%>
   <htmlb:tableView id="tab1"
                  table="<%= itab3 %>"
                 visibleRowCount="8"
                  design="ALTERNATING"
                  footerVisible="TRUE"
                 selectionMode="multiSelect">
     </htmlb:tableView>
   <%endif.%>
    </htmlb:form>
  </htmlb:page>
</htmlb:content>
TYPES
types : tab type table of ZNW_SID_NUM_TEST.
types : row type ZNW_SID_NUM_TEST.
PAGE ATTRIBUTEs :
Irow type row
Itab type tab.
Itab3 type tab.
Itab2 type selectedrows.
Rowselected type string.
onCreate
select * from ZNW_SID_NUM_TEST into corresponding fields of table itab
onInputProcessing
CLASS CL_HTMLB_MANAGER DEFINITION LOAD.
IF event_id = CL_HTMLB_MANAGER=>EVENT_ID.
  DATA: event TYPE REF TO CL_HTMLB_EVENT.
  event = CL_HTMLB_MANAGER=>get_event( runtime->server->request ).
if  event->id = 'but1' and event->event_type = 'click'.
  DATA: tv TYPE REF TO CL_HTMLB_TABLEVIEW.
  tv ?= CL_HTMLB_MANAGER=>GET_DATA(
                  request      = runtime->server->request
                  name         = 'tableView'
                  id           = 'tab1' ).
IF tv IS NOT INITIAL.
DATA: tv_data TYPE REF TO CL_HTMLB_EVENT_TABLEVIEW.
  tv_data = tv->data.
refresh itab2.
refresh itab3.
call method tv_data->GET_ROWS_SELECTED
      receiving selected_rows = itab2.
endif.
data : ind type SELECTEDROW,
       row_s type row.
if itab2 is not initial.
    data :rw LIKE LINE OF itab.
    loop at itab2 into ind.
      READ TABLE itab INDEX ind-index into
      rw.
       if rw is not initial.
       row_s = rw.
      append row_s to itab3.
      clear row_s.
      endif.
    endloop.
endif.
Endif.
This gets the values selected in Multiselect mode and displays them in another table.
Hope this helps,
Regards,
Siddhartha

Similar Messages

  • How can I change the style of a row in tableview?

    Hi,
    How can I change the style of a row in tableview, for example ,I have 10 items in table view, and I'd like to change row 1,4,10 background-color:red; font-family:Arial ,Font-Weight:BOLD.
    Any suggestion?

    Yes, I knew how can I change the style using cell factory. there is a lot of work to do if it has so many columns in table view. we need to implement every cell factory, Do we have a simple way to change the whole row style , just like fabsav said, I 'd like to set the special row like this line:
    tableview.getItems().get(i).setStyle("myRowstyle"); And I found a bug if I implement my functionality with cell factory way, I can't change the cell style after rendering cell.
    protected void updateItem(Object object, boolean empty) {
          super.updateItem(object, empty);
    }updateItem() was only triggered while cell is being rendering, there is no way if I'd like to change the cell style after rendering event.
    Hi fabsav, How can I apply a CSS class to a specific row? Can you please provide a short example?
    Edited by: imtoocute on Aug 28, 2012 10:31 AM

  • How to add rows in tableview using javascipt

    Hi
    I had tableview and button in my page.If i click on the button one new row should be appended to the existing tableview.
    so , how to add rows in tableview using javascipt which are editable?
    Regards,
    Pydi.

    Hi,
      Javascript is client scripting language, which is mainly used for validations at the client side.
      To add new row using a HTMLB tag ucannot use javascript. Instead pass "visibleRowCount" variable to a abap variable and add the variable on every button click.. that wil increase the visible row count.
    Also the size of the table view is the size of the itnernal table, so append a blank like to the internal table or insert it at the top.
    If you are not using HTMLB tags and using simple HTML tags u can always add a row using java script.
    Regards
    Imran.

  • ADF treetable - Identify RightClick of selected vs unselected row

    Hello,
    We have a tree table with client and server Listeners set for selection and contextMenu types
    TreeTable is set to use contextMenu select = true
    Use Case 1
    User selects a Row
    selection listener fires
    Use Case 2
    User right clicks a selected Row
    contextMenu listener fires
    Use Case 3
    User right clicks a unselected Row
    selection listener fires
    contextMenu listener fires
    We need to differentiate between Use Case 1 and 3
    For Use Case 3, our requirement is to suppress/ignore the firing of selection Listener
    A possible approach could be to read the event source (tree table) and check if any immediate oncoming event is of type contextMenu, and then bypass the code inside selectionListener
    Any pointers ?

    Couple of points
    1. The documentation mentions the use of getRowKey() which is returning null
    The highlighted row key is established as a currency in the table when the action for context menu item is executed. The currency in the table can be retrieved by calling "table.getRowKey()"
    2. As posted, we are interested to know if the row was right clicked and then disregard the selection Listener. The server listener for context menu select is fired after the selection listener. So we need help
    Any pointers ?
    Thanks

  • How to get number of rows in tableview

    Hello,
    Could anybody help me on how to get the number of rows in a tableview? Sort of using DESCRIBE TABLE in classic ABAP.
    Thanks,
    Ricky

    There is an attribute of the class CL_HTMLB_TABLEVIEW named
    ROWCOUNT.
    Inside an event u need to get this info use this code:
    Replace 'Monitor'  for the ID of your tableview
    DATA: tv TYPE REF TO CL_HTMLB_TABLEVIEW,
          r_count  type i,
          tv ?= CL_HTMLB_MANAGER=>GET_DATA(
          request = runtime->server->request
          name = 'tableView'
          id = 'Monitor' ).
          IF tv IS NOT INITIAL.
            DATA: tv_data TYPE REF TO CL_HTMLB_EVENT_TABLEVIEW.
            tv_data = tv->data.
            r_count = tv_data->rowcount.
          ENDIF.

  • Dynamic rows in TableView Iterator

    Hello All,
    I am developing an application in which there would be a TableView with last column as a button. OnClick event on the button should add the row below the current row (the facility should be like an Excel spreadsheet where we can insert the rows below). Can it be acheived by re-populating the internal table which his attached with TableView Control.
    Is it Ok to use TableView in such a condition or we have to go with pure HTML tables or some kind of ActiveX controls?
    Thanks in advance.
    Thanks And Regards
    Rajeev Patkie

    Hallo Rajeev,
    > Is it Ok to use TableView in such a condition...
    It is OK to use the tableView as long as it works for you! Once we run into problems, then of course one has to see if the functionality is "working as designed" and whether it was designed to handle your specific request.
    However, what you want to achieve sounds relatively harmless. Just use onclick on the button to trigger a server round trip. (Nice idea: write the row index directly into the onclick string!). Then add a new empty row into your at the correct index (see ABAP documentation), and just render table new.
    All of this should be relatively easy. Why don't you try, and let us see what you achieve.

  • Unable to see rows in tableview

    I tried to add rows to my table dynamically using ObservableList but it is not visible in table.I tried to print the data in ObservableList which is printing as expected. I even tried to initialize but not visible.
    I used Scene Builder (1.1) and NetBeans 7.4 .
    fx:id is all correct according to my understanding.
    Code Snippets
       @FXML
        private final  TableView<Person> table; // Person is a class with two string variables firstName and lastName
        @FXML
         private final TableColumn<Person,String> firstNameColumn; 
        @FXML
         private final TableColumn<Person,String> lastNameColumn;
          private final ObservableList<Person> persons;
            this.persons = FXCollections.observableArrayList(new Person("Lijo", "Jose"));
            table=new TableView<>();
            firstNameColumn=new TableColumn("First Name");
            lastNameColumn=new TableColumn("Last Name");
            firstNameColumn.setCellValueFactory( new PropertyValueFactory<Person,String>("firstName"));
            lastNameColumn.setCellValueFactory( new PropertyValueFactory<Person,String>("lastName"));
            table.setItems(persons);
            assert table.getItems() == persons;
           boolean add= persons.add(new Person(firstNameField.getText(), lastNameField.getText()));          
           System.out.println("Adding Row..."+add );
           table.setItems(persons);
    <TableView fx:id="table" layoutX="26.0" layoutY="14.0" prefHeight="186.0" prefWidth="200.00009999999747">
    <columns>
    <TableColumn id="firstNameColumn" prefWidth="100.0" text="First Name" fx:id="firstNameColumn" />
    <TableColumn id="lastNameColumn" prefWidth="100.0" text="Last Name" fx:id="lastNameColumn" />
    </columns>
    </TableView>
    Please help !!
    Thanks in Advance
        Lijo Jose

    Hi All,
    I am a newbie to JavaFX.I updated the code as suggested but still not working. Complete code for the application is copied below  .
    Please Help!!
    Try2.java
    import javafx.application.Application;
    import javafx.fxml.FXMLLoader;
    import javafx.scene.Parent;
    import javafx.scene.Scene;
    import javafx.stage.Stage;
    public class Try2 extends Application {
        @Override
        public void start(Stage stage) throws Exception {
            Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));
            Scene scene = new Scene(root);
            stage.setScene(scene);
            stage.show();
         * The main() method is ignored in correctly deployed JavaFX application.
         * main() serves only as fallback in case the application can not be
         * launched through deployment artifacts, e.g., in IDEs with limited FX
         * support. NetBeans ignores main().
         * @param args the command line arguments
        public static void main(String[] args) {
       launch(args);
    FXMLDocumentController.java
    import java.net.URL;
    import java.util.ResourceBundle;
    import javafx.collections.FXCollections;
    import javafx.collections.ObservableList;
    import javafx.event.ActionEvent;
    import javafx.fxml.FXML;
    import javafx.fxml.Initializable;
    import javafx.scene.control.Label;
    import javafx.scene.control.TableColumn;
    import javafx.scene.control.TableView;
    import javafx.scene.control.TextField;
    * @author admin
    public class FXMLDocumentController implements Initializable {
        @FXML
        private TextField firstName;
        @FXML
        private TextField lastName;      
        @FXML
        private TableView<Person> table;
        @FXML
        private TableColumn<Person,String> firstNameColumn;
        @FXML
        private TableColumn<Person,String> lasttNameColumn;
        @FXML
        private Label label;
        private final ObservableList persons=FXCollections.observableArrayList(new Person("Lijo", "Jose"));
        @FXML   
    private void addButtonAction(ActionEvent event) {
            boolean add = persons.add(new Person(firstName.getText(),lastName.getText()));
            System.out.println("Adding .."+add);     
            label.setText("Added..");      
        @Override
        public void initialize(URL url, ResourceBundle rb) {
            // TODO
            table.setItems(persons);
    FXMLDocument.fxml
    <?xml version="1.0" encoding="UTF-8"?>
    <?import java.lang.*?>
    <?import java.util.*?>
    <?import javafx.scene.*?>
    <?import javafx.scene.control.*?>
    <?import javafx.scene.layout.*?>
    <?import javafx.scene.text.*?>
    <AnchorPane id="AnchorPane" prefHeight="235.0" prefWidth="286.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2" fx:controller="try2.FXMLDocumentController">
      <children>
        <Button fx:id="button" layoutX="217.0" layoutY="23.0" onAction="#addButtonAction" text="Add" />
        <TextField id="lastname" fx:id="firstName" layoutX="14.0" layoutY="23.0" prefWidth="82.0" promptText="First Name" />
        <TextField fx:id="lastName" layoutX="113.0" layoutY="22.0" prefWidth="82.0" promptText="Last Name" />
        <TableView fx:id="table" layoutX="14.0" layoutY="58.0" prefHeight="145.0" prefWidth="190.0">
          <columns>
            <TableColumn maxWidth="5000.0" minWidth="10.0" prefWidth="95.0" text="First Name" fx:id="firstNameColumn" />
            <TableColumn maxWidth="5000.0" minWidth="10.0" prefWidth="95.0" text="Last Name" fx:id="lasttNameColumn" />
          </columns>
        </TableView>
        <Label fx:id="label" layoutX="14.0" layoutY="215.0" prefHeight="13.0" prefWidth="113.0" text="">
          <font>
            <Font size="10.0" />
          </font>
        </Label>
      </children>
    </AnchorPane>
    Person.java
    class Person {
        private String firstName,lastName;
        Person(String firstName, String lastName) {
            this.firstName=firstName;
            this.lastName=lastName;
         * @return the firstName
        public String getFirstName() {
            return firstName;
         * @param firstName the firstName to set
        public void setFirstName(String firstName) {
            this.firstName = firstName;
         * @return the lastName
        public String getLastName() {
            return lastName;
    Thanks
    Lijo Jose

  • Adding/removing rows in TABLEVIEW

    Hi. I've got a TABLEVIEW in one of my subscreens. But when load itab into that tableview with 'LOOP AT...'  tableview appears but I can't add rows to it. I can't delete existing rows too. What should I add to my programm to have possibility of adding/removing rows from my tablewiev? Greetings. P.

    Hi Friend,
    To add/delete rows in your table view.
    You have to add/delete rows from internal table fro where you are displaying values.
    You have to write code in PAI..
    In LOOP ... ENDLOOP check the OK_CODE if it is ADD (for eg.) you have to add a blank row to internal table by just passing a blank work area.
    And if it is DELETE (for eg.) delete the row of that index (TABLEVIEW-CURRENT_LINE)...
    for these two excersies you have to readjust lines of tableview...after taking number of lines from internal table (DESCRIBE TABLE INT_EX LINES WS_LINES
    TABLEVIEW-LINES = WS_LINES) write this piece of code in Intialization.
    Hope it will solve the problem.
    Regards
    Krishnendu

  • Adding new rows in tableview of BSP

    Hi all,
       I am facing the very serious problem with using the tableview in bsp .The requirement is to add new rows to the tableview and update this content to internal table.The problem is when i enter some value in column and hit any button or triggered any event ,the value of column in table view gets cleared and i couldn't able to captur the value to internal table ...
    can anyone please help me to  sort out this problem.

    Hi Senthil,
    I think this would provide solution to your problem.
    the problem is whenever you edit the value in the tableview view the associated internal table of the table view has to be updated with the new values. for that you need to read the cell value from the table view.
    as its a tableview, you should read the value from the exact cell whose value has been modified and update that value in the internal table. here is the psuedocode. hope it helps.
    loop thru the selected rows of the table,
    'selectedrowindextable'  this info you can get from
    table_event TYPE REF TO cl_htmlb_event_tableview.
        LOOP AT selectedrowindextable ASSIGNING <i>.
    itab is the table which actually stores that data
    which you pass to the table view
          READ TABLE  itab INTO wa_itab INDEX <i>.
          i_rownum = <i>.
          CONDENSE i_rownum.
    construct the id of the Cell whose value is to be read
    for table view name, if u r showing it as a view in a
    tray object prefix the table view name with tray object
    id followed by '_'
    to read column 'totalcost' in 5th row the cell name
    would be 'trayid_tableviewid[5].totalcost
    Alternative you can get this format from the
    request->get_form_fields method also
       CONCATENATE 'tabviewname[' i_rownum '].colname' INTO req_cell.
       CONDENSE req_cell.
       l_value = request->get_form_field( req_cell ).
       CONDENSE l_value.
       wa_itab-colname = l_value.
       MODIFY itab FROM wa_itab INDEX <i>.
    ENDLOOP.
    Let me know if you have any questions.
    thanks and Regards,
    Kumar

  • Highlight specific rows in tableview

    I realize that my use of the word highlight is somewhat ambiguous, in the docs its seems to be synonymous with selected. My question is: can you choose to set a background color, or somehow otherwise mimic highlighting for specific rows in a TableView? My example would be file and folder Labels in the finder. They allow a color to be displayed behind a row in the table.

    You can consider 2 options. You can change your node selection property to  0..n , and loop through the node and set the selected property to true based on your logic.
    You can also bind cell editor  design property to context attribute  and bind this attribute to columns cell editor design. You can find wiki about coloring table column.

  • Add/Delete rows in TableView

    hi all,
    i wanna add rows in the tableView and also wanna delete the selected rows from the tableView.
    how to do it?
    regards,
    purushothaman.

    Hi,
    As Harish said, use addElement to add elements to the Vector (using which you have created the DefaultTableViewModel and assigned it to your tableview).
    Capture the index of the rows to be deleted and use
    <Vector>.removeElementAt(index) to remove the specific rows.
    Check out this link as well
    http://help.sap.com/saphelp_nw04/helpdata/en/a9/76bd3b57743b09e10000000a11402f/frameset.htm
    http://java.sun.com/j2se/1.5.0/docs/api/
    Thanks
    Senthil
    P.S: Reward points for useful answers

  • Selected rows in tableview

    Hello,
    Using a tableview with table iterator, the user can select one or more lines and delete them by using a button.
    A server event is triggered then to delete the data on the database. But afterwards the tableview appears with the same row indexes selected. But I don't
    want to have any selected rows afterwards and I don't know
    in fact where this indexes are from, where they are kept.
    The selected rows come from table->data
    ->PREVSELECTEDROWINDEXTABLE to delete the selected rows.
    The deletion of this indextable afterwards does not help to get rid of the selected rows after the server event.
    <htmlb:tableView id                    = "<%= l_ref_wa-QSDS_I_R3QSC_FIELDS-fields %>"
                         table                 = "//g_page1model_view/QSDS_I_QS_INPUT_NR2"
                         headerVisible         = "FALSE"
                         footerVisible         = "FALSE"
                         design                = "alternating"
                         selectionMode         = "MULTISELECT"
                         iterator              = "<%= g_page1model_view->tv_iterator %>"
                         focus1stSelectedCell  = "FALSE"
                         tabIndexCell          = "FALSE"
                         tableLayout           = "FIXED"
                         keepSelectedRow       = "FALSE"
                         headerText            = "<%= l_ref_wa-header %>"
                         allRowsEditable       = "X" />
    Anyone could help me.
    kind regards.
    Carola

    Hi Carola,
    some months ago a cool dude in this forum posted this code =)
        cl_htmlb_manager=>check_tableview_all_rows(
        rowcount = table_event->ROWCOUNT
        request = request
        id = '<YOUR TABLEID>'
        keytable = table_event->PREVSELECTEDROWKEYTABLE
        check = '' ).
    I am using it to deselect my tables and it works without any problems, have fun.
    regards
    Thomas

  • Capture the rows selected ,tableView

    Hi Friends,
    I have a requirement and i was searching in the forum and i have seen the same question been asked 
    Capture the rows selected in a multiselect table view (BSP)   but i couldn't able to judge how the thread is closed
    We have a tableView that is filled on selecting a value from a dropDownListBox.
    and now i select some rows from the table view and click on a button(say btn_ok)
    now the data is processed .
    now what is my requirement is when   i again run the page and select the same drop down value i want to see the rows to be already selected for which i have done before
    example
    dropdown -
    > a is selected
    table view
    1----> selected
    2
    3---->selected
    4
    5---->selected
    6
    btn ok
    next time i want to c these selected rows already as SELECTED
    Regards
    Bhavana

    Hi,
    Are you able to fetch single row? If yes then debug and try to solve it. I don't have SAP System right now but this will help you. First change your table selection mode "Multiple". After that write following code in your "OnInputProcessing"
    Sending Selected Field to the calling Screen
    DATA : tv      TYPE REF TO cl_htmlb_tableview,
           tv_data TYPE REF TO cl_htmlb_event_tableview,
           event   TYPE REF TO cl_htmlb_event.
    tv ?= cl_htmlb_manager=>get_data(
            request = runtime->server->request
            name    = 'tableView'
            id      = 'tv_field' ).
         RECEIVING
           data    = tv.
    tv_data = tv->data.
    w_field = tv_data->row_key.
    Where w_field is your field name. By the way this I used to get one row. Try debugging and may be you will find your way.
    Thanks,
    Muhammad Usman

  • Summary row in tableview (including sorting and BYPAGE navigation)

    Hello everybody,
    I already found a few topics dealing with this problem but I wasn't able to find a real solution for this.
    So far I'm pretty familiar with table iterators but I have no idea how to handle the summary row to be the last line in a table, even if sorting and navigation by page is allowed in the tableview.
    I think you definitely have to add this summary row in your internal table, since you can not add a virtual row in your tableview. And you can custom render this row or respectively each cell for instance with a different color but how to force this row always to appear as the last row in every tableview page (navigation=BYPAGE).
    Does anyone have a solution for that?
    Thanx
    Oliver

    Ok, here is what I came up with (hoping I got your problem right):
    In your tableview you are displaying <b>x</b> rows, and after these rows you want your sum row to be displayed.
    I have done quite some things with iterators, but why not do without one here
    Altering the internal table can do as well:
    Try to insert a new row after every <b>x</b> rows into your internal table which holds the needed sum values, and then change your tableview to display <b>x+1</b> rows.
    In you case you need to do some operations with your internal table (to avoid the sum rows messing up the results) you should somehow "mark" these sum rows so you can distinguish them later on.
    Hope this is helpful for your problem.
    Max

  • Unselect rows in WAD automatically

    Hello experts,
    how can I unselect automatically selected rows in an analyse item in WAD, if I switch to another tab-strip e.g.?

    Hi Robert,
        Yes there is a Way to Do this.
    Here is how.
    1) Click on the First Tab Panel and Go to Edit Mode.
    There are 5 Things you can change here
       a) Caption
       b) Icon
       c) Activation Action
       d) Deactivation Action
       e) Subordinate Web Item
    What you need to change is the *Activation Action. *
    Command.
    If you click on the Command then Command Wizard Should Pull Up.
    When Command Wizard is Displayed Do the following.
    1) Click on ALL Commands Tab.
    2) Click on Commands for Web Items to open it.
         From that List Pick the First Command. Click on BACK_TO_INITIAL_ITEM_STATE. This will highlight that option.
    3) Click on NEXT at the bottom of the Command Wizard.
    4) Pick the Target Web Item -> Analysis_ITEM_1 if that is the one on Tab 1
    5) Click NEXT.
    6) Click OK
    7) Click OK
    Repeat the Above Steps for Tab Panel 2.
    I have got this to work. Get back if its not working.
    Hope this Helps!!
    Datta.

Maybe you are looking for