How can select Multiple Rows in a Jtable

Dear Forum
i am working on jclient\swing.
I want to select More than one row at a time from a table
I am trying the following code at INIT but it is not working.
jTable1.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
Please suggest me for the same.
Thankx

Girdhar,
I tried with JDeveloper 9.0.3 and it worked.
Either you are using another JDeveloper version, or you need to specify what you mean with "is not working".
Frank

Similar Messages

  • How to select multiple rows from List Of Values

    Hello,
    I use ADF 11g to create my list of values (LOV). I want to select multiple rows from it. but i can't.
    so how i can select many rows to set them in my adf table.
    Thank in advance

    Hi,
    LOV is map to an attribute in the viewObject so it will return only one value or more values from selected row. You can't select multiple rows from LOV.
    But you can do this by using popup which you can select multiple rows and insert the selected rows to another table.
    This blog post explain how to achieve this :
    http://husaindalal.blogspot.com/2009/11/search-from-popup-and-add-to-new-table.html#comments
    Sameh Nassar

  • How to select multiple row in ALV report

    Hi friends,
    1. How to select multiple row in ALV report
                   ( How to set tab in ALV report and want to select multiple line.)
    Thanking you.
    Subash

    Hi Sahoo,
    If you are using the class CL_GUI_ALV_GRID. In methods SET_TABLE_FOR_FIRST_DISPLAY.
    in layout structure you will find field SEL_MODE
    pass :
    LS_LAYOUT-SEL_MODE = 'A'.
    In PAI.
      CALL METHOD GRID->GET_SELECTED_ROWS
        IMPORTING
          ET_INDEX_ROWS = T_ROWS
          ET_ROW_NO     = T_ROWID.
    Hope these will solve your problem.
    Regards,
    Kumar M.

  • How to select multiple row of table using check box?

    hi,
             i am having table on view having first field as checkbox. what i want, when i click on checkboxes in multiple rows, and i click on any button i need to use those content to next view...
              my problem is if i select only one row , i can use onlead select property of table..but when i select multiple rows  through check box how should i read contents of table....?
    Plz solve it.
    Thanks,
    Saurin Shah

    Hello Saurin,
    You are right using LeadSelection you can select only 1 row at a time. You will have to make use of Selection for achieving this. First you will have to change the selection mode of the table to multiple & also change the selection property for the related context to 0..n . Please find a code extract which might help you. (However this facility is only available from SP 14.) The main part is using the set_selected method of if_wd_context_node.
    data: node_zcourse_details type ref to if_wd_context_node,
             node_course_assign type ref to if_wd_context_node,
             elem_course_assign type ref to if_wd_context_element,
             stru_course_assign type if_v_details=>element_course_assign ,
             item_popin_selected like stru_course_assign-popin_selected.
    "     navigate from <CONTEXT> to <ZCOURSE_DETAILS> via lead selection
    node_zcourse_details = wd_context->get_child_node( name = if_v_details=>wdctx_zcourse_details ).
    "     navigate from <ZCOURSE_DETAILS> to <COURSE_ASSIGN> via lead selection
    node_course_assign = node_zcourse_details->get_child_node( name = if_v_details=>wdctx_course_assign ).
    "     @TODO handle not set lead selection
    if ( node_course_assign is initial ).
    exit.
    endif.
    data elem_set type wdr_context_element_set.
    field-symbols <wa_elem> like line of elem_set.
    elem_set = node_course_assign->get_elements( ).
    loop at elem_set assigning <wa_elem>.
       <wa_elem>->set_selected( TRUE OR FALSE ). " Supply either TRUE/FALSE in here
    endloop.

  • How can i add rows to a JTable at run time ??????

    hi there
    how can i add a row to a JTable at run time? and display the table after the change? thank you.

    For adding or removing the rows from the JTable, you have to use the methods on the table model. I would show you a simple implementation of table model.
    public class MyTableModel extends AbstractTableModel {
    private ArrayList rowsList = null;
    private String [] columns = { "Column 1" , "Column 2", "Column 3"};
    public MyTableModel() {
    rowsList = new ArrayList();
    public int getRowCount() {
    return rowsList.size();
    public int getColumnCount() {
    return columns.length;
    public void addRow(MyRow myRow) {
    //MyRow is any of your object.
    rowsList.add(myRow);
    fireTableDataChanged();
    public void removeRow(int rowIndex) {
    rowsList.remove(rowIndex);
    fireTableRowsDeleted(rowIndex, rowIndex);
    public Object getValueAt(int row, in col) {
    MyRow currentRow = (MyRow)rowsList.get(row);
    switch (col) {
    case 0:
    //return the value of first cell
    break;
    case 1 :
    //return the value of second cell
    break;
    case 2 :
    //return the value of third cell
    break;
    }Then create the table using the TableModel using the constructor new JTable(TableModel) and then when you want to add/remove a row from the table, call myTableModel.addRow(MyRow) or myTableModel.removeRow(rowIndex)....I hope that this solves your problem.

  • Select multiple rows on a JTable

    Hi!
    Given: JTable, multiple selection allowed
    Wanted: a way to be able to set multiple non-continuous rows selected
    eg. on a JTable with 5 rows,
    I want to set rows 1, 3 and 5 selected
    Anyone?
    Stoffel.

    table.setSelectionMode(ListSelectionModel.MULTIPLE_INTE
    VAL_SELECTION);
    select rows using <ctrl> and/or <shift>Or if you want to set programaticly use this methods, see the api
    for explanation.
    table.changeSelecton(int row, int column, boolean toogle, boolean extend);
    table.addRowSelection(int index0, int index1);
    table.addColumnSelectionInterval(int index0, int index1)
    ...

  • How can I add rows to a JTable based on an Abstract Table Model?

    I have done this ...
    public class myui extends JPanel {
    private AbstractTableModel jTable1Model;
    blah blah
            jTable1Model = new AbstractTableModel() {
                 String[] column = new String[]{"TID", "Name", "Address"};
                 Vector<Vector<Object>> table = new Vector<Vector<Object>>();
                 @Override
                 public int getRowCount() {
                      return table.size();
                 @Override
                 public int getColumnCount() {
                      return column.length;
                 @Override
                 public String getColumnName(int col) {
                      return column[col];
                 @Override
                 public Object getValueAt(int row, int column) {
                      return table.get(row).get(column);
                 @Override
                 public void setValueAt(Object value, int row, int column) {
                      table.get(row).set(column, value);
                      fireTableCellUpdated(row, column);
                 public void insertRow() {
                      Vector<Object> columns = new Vector<Object>();
                      columns.add(null);columns.add(null);columns.add(null);
                      table.add(columns);
                      fireTableRowsInserted(0, table.size());
    blah blah
        public synchronized void ImportVisitorDataToJTable1(Object value, int row, int col) {
            jTable1Model.InsertRow();  <-----///// This line not being recognised as a valid member function call
           jTable1.setValueAt(value, row, col);
    }I thought to insert a row I can define a function in the abstracttablemodel class and then instantiate the class and override or create new methods that I can use.
    But after instantiating the class and overriding appropriately and adding the insertRow function, when I try to use it in ImportVisitorDataToJTable1 as seen above its not being recognized as a funtion of jTable1Model

    1. respect naming conventions. Example: myui --> MyUI, ImportVisitorDataToJTable1 -->importVisitorDataToJTable1
    2. convert Anonymous to Member: AbstractTableModel --> MyTableModel
    3. row parameter makes no sense here as it depends on current row count:
        public synchronized void importVisitorDataToJTable1(Object value, int col) {
            int row = jTable1Model.getRowCount();4. here is a more adequate "fireTable.."-call for insertRow:
    fireTableRowsInserted(table.size() - 1, table.size() - 1);
    5. check if you can take advantage using DefaultTableModel as suggested by Maxideon.

  • How to Select  a Row in a JTable, on a right mouse click?

    Hi all!
    I need to know the Row index in a JTable, on a right mouse click?
    Executing following code, I get the "Column Number" on a mouse click
    TableColumnModel columnModel = tableView.getColumnModel();
    int viewColumn = columnModel.getColumnIndexAtX(e.getX());
    int columnIdx = tableView.convertColumnIndexToModel(viewColumn);
    Dows any body know the code that gets "rowIdx" on a mouse e.getY() method??
    Hope early response!

    int row = table.rowAtPoint( e.getPoint() );
    int column = table.columnAtPoint( e.getPoint() );

  • How to select a row in a JTable

    I want the following to happen: depending on the value of a variable, i have to change the background color and font of one row. Has anyone an idea how to do that?
    Thx

    check out http://www.globalleafs.com 's download section. There are many programmes out there in java.

  • Selecting multiple rows in JTable

    Hi
    I wonder if it is possible to select multiple rows in a JTable. I have written the following:
            table.setRowSelectionAllowed(true);
            table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);However, when I select a second row, my first selected row unselects. I have to shift-click manually to select both rows. Is there a way around this (ie. without the shift-click part)?

    Well I have done that without finding anything... can you provide a link?

  • Selecting multiple rows in a datagrid

    How do you make it so that you can select multiple row in a
    datagrid, and I don' t just mean like make it so you click a button
    and five different rows are suddenly highlighted. I mean like you
    manually go through and select each row that you want and it
    highlights each one as you select it.

    yourDatagrid.allowMultipleSelection=true
    should do the trick for you
    Regards
    Craig

  • Selecting multiple rows of an alv

    Hi All,
    I have a requirement where in i have to select multiple rows of an alv and when i click a button i should get the data of all the selected rows, i am able to select only one row by default , how to select multiple rows or records,i am new to this Web dynpro alv , can aynbody please help me on this.
    Thanks,
    Praveen.

    hi, praveen kumar.
    About how to make "Multiple-select" of ALV available, you can take a reference of the following coding. Just one example:
    ****ALV Config****
      DATA:
          lr_salv_wd_table TYPE REF TO iwci_salv_wd_table,
          l_value TYPE REF TO cl_salv_wd_config_table,
          lr_table_settings TYPE REF TO if_salv_wd_table_settings.
       lr_salv_wd_table = wd_this->wd_cpifc_alv_child( ).  "Your statically declared ALV component usage
       l_value = lr_salv_wd_table->get_model( ).
    * tabel setting
      lr_table_settings ?= l_value .
      lr_table_settings->set_selection_mode( cl_wd_table=>e_selection_mode-MULTI ).
    About how to get your selected records of ALV, you can make use of the context node bound to your ALV component. For example,
    ****get selected elements****
    lt_elems = lo_node->GET_SELECTED_ELEMENTS(
          INCLUDING_LEAD_SELECTION = abap_true ).
    These are just examples. For detail, you can search them.
    Thanks.Best wishes.

  • Selecting multiple rows in BW Web reports

    Hello Everyone,
    I am working on the BW web report where we want to give user interaction screen through BSP.
    We achived this for a single row in BW report where when user clicks on some link or button it opens up the BSP screen with the selected row value in BW report.
    Now we want to give multiple rows option where user can select multiple rows in BW report and the corresponding values should be available in BSP by clicking of some button in BW.
    has anyone done this before. thanks in advance.
    regards
    rajeev

    HI
    Int leadSelection = wdcontext.nodemodelnode.getLeadSelection();
      for(int i=0;i<wdcontext.nodeModelNode.size;i++)
        if(wdcontext.nodeModelNode.isMultiselected(i) || leadSelection ==i)
               String name = wdcontext.nodemodelnode.getnameelementatindex(i).getName();
               String  address = wdcontext.nodemodelnode.getaddresselementatindex(i).getAddress();
               String age = wdcontext.nodemodelnode.getAgeelementatindex(i).getAge();
            Create a method for the Table Property onLeadSelect() where you can open a popup window
             Create a value node and with attributes same as Table attributes and then set the values of the table
             to the value node attributes.
    Thanks

  • Selecting multiple rows of a table

    Hi Forum,
    How to select multiple rows of a table at a time? Please help me..
    Thanks
    Swapna

    Hi Swapna,
    To select more then one row in table, just set the selectionmode property of table to 'multi' or 'auto' and also change the selection property of the node (to which table is binded) to  0:n.
    I hope it helps.
    Regards
    Arjun
    Edited by: Arjun on Feb 4, 2009 11:52 AM

  • How to create multiple rows in a child table from the multi select Lov

    Hi
    We have Departments and EmployDept and Persons tables and each employee can associate multiple departments and vice versa.While creating a Department page there should be a Multi Select LOV(values from Persons table) with search option for the Persons.From the search panel we can select multiple persons for that department.Suppose we have selected 5 persons and click on submit, then it should create 5 rows in the EmployDept table for 5 persons with that department id.
    Any inputs on how to implement this scenario please..

    Maybe you can get some ideas from here -
    http://adfdeveloper.blogspot.com/2011/07/simple-implementation-of-af.html

Maybe you are looking for

  • Unable to export BPM Project

    I'm on Jdeveloper 11.1.1.6.0 and have installed the plugin bpm-jdev-extension.zip and have successfully created a BPMN process. I've been able to deploy the composite and it works great. However, I'd like to be able to export the project in Jdevelope

  • Entourage 2008 and iSync

    Hey everyone, I was using the new Entourage 2008 and loved it, until I realized it was going to take A LOT of work to get it to sync with my Palm Centro. I ended up switching back to Entourage 2004 which is really starting to tick me off. Here's what

  • Joining the Tables VBAK and CDHDR

    Hi All, I am a novice to SAP, and probably have the most basic question. I need to join the two tables VBAK and CDHDR and I dont see any common fields between them. I would need to do this for as generating a custom report that lists all the valid co

  • How do I duplicate an audio cd using Disk Utility?

    I follow the instructions and after it creates the image it says to put in the new cd. Then it says there is not enough room on the new cd and won't let me continue. But it is a new blank cd. Any ideas? Thanks

  • Oracle CRM On Demand Statement of Direction

    All, the Oracle CRM On Demand Statement of Direction document is now available in MetaLink. The Doc ID is 734444.1