Table multi selection

I am using a Jtable with MULTIPLE_INTERVAL_SELECTION.
I saw in the java doc that this means:
" A value for the selectionMode property: select one or more
contiguous ranges of indices at a time."
I want a normal multi selection behaviour:
enabling the user to wark with ctrl or shift and mouse clicks to select several rows.
(currently the shift is working but only with the keyboard keys).
How can i set this behaviour?

Use this table model ...
package framework;
import java.util.*;
import javax.swing.*;
import javax.swing.table.*;
public class MultipleSelectionTableModel extends DefaultTableModel
   Vector rowVector;
   Vector columnVector;
   public MultipleSelectionTableModel(Vector rowVector, Vector columnVector)
      for (int i = 0; i < columnVector.size(); i++)
         this.addColumn(columnVector.get(i).toString());
      for (int i = 0; i < rowVector.size(); i++)
         this.addRow((Vector) rowVector.get(i));
   public Class getColumnClass(int columnIndex)
      Object o = getValueAt(0, columnIndex);
      if (o == null)
         return Object.class;
      else
         return o.getClass();
   public boolean isCellEditable(int rowIndex, int mColIndex)
      if (mColIndex == 0)
         return true;
      else
         return false;
}You would set this table model as ..
         MultipleSelectionTableModel myDefaultTableModel = new MultipleSelectionTableModel(rowDataVector, columnVector);
         yourTable.setModel(myDefaultTableModel);hope it'd do ;)
Cheers...
Asim

Similar Messages

  • ADF Table Multi Select Issue

    Hi,
    I have a read only table with multi select and a panel form based on the same VO. The from has editable component through which the user modifies the data.
    When the user selects a single row in the table -> the form shows the corresponding data.
    When the user selects multiple rows using cntrl key say ROW_1, ROW_2, ROW_3 the form displays data of ROW_3.
    However after this if i click on ROW_1(single row selection) , the form still shows the data of ROW_3. How to show the correct data in from
    My Jdev 11.1.1.4
    Thanks
    Ajay

    Well, your use case is somewhat problematic. It doesn't make sense to have an edit form together with a multi select table, as the user can't be sure which row data he sees in the edit form.
    This said, you need to know, that the af:table has two properties which should not used together: SelectionListener, selectecRowKey should not used with rowSelection="multiple".
    For multiple select table you should not populate these properties. (http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/web_tables_forms.htm#sthref2010)
    You can e.g. add a column to your table containing a link to allow edit of the row. Then you can use multi selection the normal way.
    Timo

  • SSAS Cube Hierarchy Default Member, not aggregatable in pivot table multi select, Urgent

    Hi All,
    I have one problem in my project ssas cube. one of the dimension hierarchy, a value has been set up as default member in calculation tab.
    The problem is:
    When i filter (select multiple) this defaulted value and other value in excel pivot, it is always showing default member value instead of selected members aggregated value. if i remove default member it is working fine. Can you please provide work around
    for this.
    Please note that, if select multiple values within that hierarchy (this time not selected default value), aggregation is working fine.
    Thanks, Rajendra

    Hi Hirmando,
    According to your description, the default member cause incorrect data when dragging a attribute that contain a default member to the FILTERS area, right?
    I can reproduce this issue on my environment, when dropping this dimension in the filter area of my pivot table and select multiple members including the default member then only data for the default member is shown. Currently, it's hard to say the root
    reason that cause this issue. In order to narrow down this issue, please apply the latest server pack and cumulative update.
    Besides, you can submit a feedback at
    http://connect.microsoft.com/SQLServer/Feedback So that microsoft will confirm if this is a know issue.
    Regards,
    Charlie Liao
    If you have any feedback on our support, please click
    here.
    Charlie Liao
    TechNet Community Support

  • Duo tables multi selection list

    Hi guys,
    I am not sure what is this called, but i need to design a ui which is similar with the change layout on top of the alv grid, where by you have 2 windows and you can choose entry to move between Displayed columns and column set.
    Any idea how is this done? Is it a control? or it just 2 ALV grid and i have to manually code the functionalities for it?
    tq.
    jeelee

    have a look at this demo program ..
    here they have button in toolbar such that to taggle between display and change mode..
    BCALV_EDIT_01

  • 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

  • How to Change default text in Multi-Selection Table Bar

    Hi,
    I would like to change the default text "Select Object" on the Multi-selection Table Bar.
    I tried adding the following in my resultsCO but I'm getting errors:
    tableBean.setTableSelectionText("<newText>");
    Error(25,34): invalid method declaration; return type required
    Error(25,35): illegal start of type
    Error(25,3): missing method body, or declare as abstract
    What am I missing?
    Thanks much.

    I got it to work with the following:
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    OATableBean table = (OATableBean)webBean;
    // Set the install-base specific "control bar" select text:
    // "Select Item(s)…"
    table.setTableSelectionText("Select Item(s)...");
    }

  • FETCHING VALUES IN MULTI RECORD BLOCK FROM ANOTHER TABLE USING SELECT STATEMENT.

    Hi,
    I have one multi record block in which i want to fetch values
    (more then one record) from another table using select statement
    IN KEY NEXT ITEM.I am getting following error.
    ORA-01422: exact fetch returns more than requested number of rows
    Thanks in advance.

    In your case I see no reason to use non-database block and to try to populate it from a trigger with a query, instead of using the default forms functionality where you can associate the block and the fields with table, create where clause using bind variables and simply use execute_query() build-in to populate the block. The power of the forms is to use their build-in functionality to interact with the database.
    Also, you can base your block on a query, not on a table and you dynamically change this query using set_block_property() build-in. You can use any dynamic queries (based on different data sources) and you simply need to control the column's data type, the number of the columns and their aliases. Something like creating inline views as a block data source.
    However, you can replace the explicit cursor with implicit one like
    go_block('non_db_block_name');
    first_record();
    FOR v_tab IN (SELECT *
    FROM tab
    WHERE col_name = :variable)
    LOOP
    :non_db_block_name.field1 := v_tab.col1;
    :non_db_block_name.field2 := v_tab.col2;
    next_record();
    END LOOP;

  • Cannot multi-select rows in a table

    I have created a view with a table that is bound to a context node.
    the context node has the properties "Cardinality" = 1..n and "Selection" = 1..n.
    the table has the property "selectionMode" = 1.
    I am not able to multi-select the rows in the table. Any idea why?

    Hi Tiberiu,
    cardinality can be 1..n or 0..n,
    selection can be 0..n or 1..n,
    InitializeLeadSelection can be checked or unchecked,
    selectionMode property of the table ui element should be Multi or MultiNoLead,
    rowSelectable should be checked
    you can hold down "Shift" or "Ctrl" buttons when selecting multiple rows
    Regards,
    Shweta
    Regards,
    Shweta

  • Get all records in multi selected master child tables

    Hi,
    I am using JDeveloper 11.1.1.4 version and using ADF-BC in my project.
    I have a simple master child[one to many] relationship in my project.
    In my view page,I display this master child [Ex: EmpVo1--->DeptVo2] as tables.
    I have multi-slection enabled for master table.
    My requirement is that,on multi selecting the rows in master tables,I want to get all the child records in my backing bean.
    that is if a master row has 3 child records and another master row has 4 child records and on multiple selection of these two records in master table,I should get all the child records in my backing bean.
    I need this to implement cascade delete functionality.
    Following is sample piece of code
    1) called on selecting the rows in master table
    public void onRSCGrpSelect(SelectionEvent selectionEvent) {
    // Add event code here...
    ADFUtil.invokeEL("#{bindings.RscGroupVO1.collectionModel.makeCurrent}",
    new Class[] { SelectionEvent.class },
    new Object[] { selectionEvent });
    RowKeySet rowKeySet = (RowKeySet)tblRSCGrp.getSelectedRowKeys();
    CollectionModel cm = (CollectionModel)tblRSCGrp.getValue();
    for (Object facesTreeRowKey : rowKeySet) {
    cm.setRowKey(facesTreeRowKey);
    JUCtrlHierNodeBinding rowData =
    (JUCtrlHierNodeBinding)cm.getRowData();
    Row row = rowData.getRow();
    System.out.println("\n" +
    row.getAttribute(0) + " :: " + row.getAttribute(1) +
    " :: " + row.getAttribute(2));
    System.out.println("Displaying Child Records");
    displayChildRecords(row.getAttribute(0));
    2. private void displayChildRecords(Object rscGrp) {
    ViewObject rscMapVo = getRscMapViewObj();
    RowSetIterator rsI = rscMapVo.createRowSetIterator(null);
    while (rsI.hasNext()) {
    Row row = rsI.next();
    System.out.println("\n" +
    row.getAttribute(0) + " :: " + row.getAttribute(1) +
    " :: " + row.getAttribute(2));
    rsI.closeRowSetIterator();
    But the problem is that ,it is always giving me the last selected rows child record details
    Please suggest the error I am doing.
    Thanks,
    Praveen

    Your problem is that you use makecurrent, which should not be used on a multi select table. Next if you have master detail relationship you should have a view link between them. In this case you can expose a method in you master to get the related child row. No need to get the VO itself as you can use the child iterator accessors to get the child record.
    public void onRSCGrpSelect(SelectionEvent selectionEvent) {
    // Add event code here...
    RowKeySet rowKeySet = (RowKeySet)tblRSCGrp.getSelectedRowKeys();
    CollectionModel cm = (CollectionModel)tblRSCGrp.getValue();
    for (Object facesTreeRowKey : rowKeySet) {
    cm.setRowKey(facesTreeRowKey);
    JUCtrlHierNodeBinding rowData =
    (JUCtrlHierNodeBinding)cm.getRowData();
    Row row = rowData.getRow();
    //cast to the right row class
    EmpEmpVoRow empRow = (EmpEmpVoRow) row;
    // now you cann access the child row iterator
    RowSetIterator it = empRow.getDepVO();
    //now you cna iterate over the child rows
    System.out.println("\n" +
    row.getAttribute(0) + " :: " + row.getAttribute(1) +
    " :: " + row.getAttribute(2));
    System.out.println("Displaying Child Records");
    //use hte child rows here
    }Not sure if the code compiles out of the box (doing this on the train :-)
    Timo

  • SSAS Default Member Causing incorrect data in Excel Pivot Table using Multi-select in filter

    I have an Excel 2013 pivot table connected to an SSAS (2012) cube. One of my dimensions has a default member specified. When I drop this dimension in the filter area of my pivot table and select multiple members including the default member then
    only data for the default member is shown. Selecting multiple members where the default member is not included does not result in an issue.
    I believe this may be in an issue in how Excel builds the MDX but wanted to see if there are any work arounds.
    This issue can be recreated using AdvetureWorks using the following steps:
    Alter the Product Dimension of the SSAS Default Member by setting the default member of the Product Line Attribute to Mountain: [Product].[Product Line]&[M] 
    Process the cube
    Connect to the cube via Excel 2013
    Drag internet gross profit to the Values area (The value will be 4700437.22 which reflects the Mountain default filter)
    Drag Product Model Lines to the Filters area (you will see Mountain selected by default)
    Change the filter by checking the Select Multiple Items checkbox and checking Mountain and Road (You will see that the amount does not change)
    Change the filter again by selecting Road only (to demonstrate that Road has a value, 5602105.8, associated with it)
    Change the filter again to select Road and Touring (to demonstrate that the correct aggregation of the two selected members is preformed)

    Hi Hirmando,
    According to your description, the default member cause incorrect data when dragging a attribute that contain a default member to the FILTERS area, right?
    I can reproduce this issue on my environment, when dropping this dimension in the filter area of my pivot table and select multiple members including the default member then only data for the default member is shown. Currently, it's hard to say the root
    reason that cause this issue. In order to narrow down this issue, please apply the latest server pack and cumulative update.
    Besides, you can submit a feedback at
    http://connect.microsoft.com/SQLServer/Feedback So that microsoft will confirm if this is a know issue.
    Regards,
    Charlie Liao
    If you have any feedback on our support, please click
    here.
    Charlie Liao
    TechNet Community Support

  • Parsing Through the Multi Selection Values in a PL/SQL Procedure

    Greetings,
    This should be an easy one for one of you PL/SQL experts. I'm not, so I am unsure how to code this up.
    I have a Multi Selection page item and am passing the value of it to a PL/SQL routine as a parameter. I am able to use the value if I only pass my procedure one value, so I have it working. Just not with multi-values I need the code in the procedure to loop through the values. How do I code that up? The procedure is relatively short and is included below. p_cell is the multi-value parameter.
    Oh yes... You probably need to know this. The values are coming in like this - 1-3:2-3:3-3:5:6
    Also, the values are the x-y coordinates of a grid I have over an image on the page. The routine removes certain cells (1-3, etc.) from the grid. The grid is created using HTML, so I have to remove lines of HTML to remove a cell from the grid. Just in case that is helpful.
    Thx, Tony
    = = = = = = =
    create or replace
    procedure qcis_remove_grid_cell(p_id IN NUMBER,p_cell IN VARCHAR2) as
    v_position number;
    v_position_from_end number;
    v_line_start number;
    v_line_end number;
    v_length number;
    v_html clob;
    BEGIN
    BEGIN
    select imagemap_html into v_html from qcis_im_template_draft
    where header_id = p_id;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    v_html := NULL;
    END;
    v_length := length(v_html);
    v_position := INSTR(v_html,'alt="'||p_cell||'"');
    v_position_from_end := (v_length - v_position) * -1;
    v_line_start := INSTR(v_html,'<area shape',v_position_from_end) - 1;
    v_line_end := INSTR(v_html,'/>',v_position) +2;
    v_html := substr(v_html,1,v_line_start) || substr(v_html,v_line_end);
    UPDATE qcis_im_template_draft SET imagemap_html = v_html WHERE header_id = p_id ;
    END qcis_remove_grid_cell;
    Edited by: cloaked on Nov 1, 2011 8:01 AM

    Not sure I understood your need, but it sounded like you need to unscramble a string into a set of rows. If so, I would give you 2 ideas:
    1. STRING_TO_TABLE function: http://www.sloug.org/i/doc/api073.htm
    2. Other ways (Regular expression or XML): http://apex-at-work.blogspot.com/2011/05/two-ways-using-string-to-table-in-apex.html

  • How to use multi select in a query report

    I defined a lov. This lov retuns name and a id. I want to use the result of this multi select in my query.
    I always get invalid number when I choose two items of the select. When I debug I see that the return value of the multi select is 1:2. How can I change the seperator : in , I tried the following but this does't work.
    if :P26_PRODUCTTYPE IS NOT NULL then
    l_sql := l_sql ||' and producttype in
    (REPLACE(:p26_producttype,'':'','','' ))';
    end if;

    as you're finding, multiple values selected from html db multi-select list items (and checkboxes) are stored as a single, colon-delimited string. i explained an easy way to handle this via pl/sql in...
    Multiple select list
    ...that post shows you how to throw the selected values into a pl/sql table and step through them as needed. it also showed how to use an instr to parse through the string if you want to go that route. you could use that same instr logic right in your sql query. so let's say your lov for your multi-select item (P1_MY_MULTISELECT, we'll call it) was defined as...
    select ename, empno from emp order by 1
    ...and your user selected KING, FORD, and JONES. :P1_MY_MULTISELECT would store those values as...
    7839:7902:7566
    ...you could then write a query to return the selected enames with something like...
    select ename, job
    from emp
    where insrt (':'||:P1_MY_MULTISELECT||':',':'||empno||':') != 0
    ...hope this helps,
    raj

  • How to get select items from multi select in an array or list in jsp

    i have the following multi select which is basically an array coming from the database how can select couple of them and put them in an array in jsp and then save them in the session so when i click the next button they continue till i reach the last finish button of my wizard:
    <SELECT MULTIPLE SIZE=5>
    <OPTION VALUE="o1">Option 1
    <OPTION VALUE="o2">Option 2
    <OPTION VALUE="o3">Option 3
    <OPTION VALUE="o4">Option 4
    <OPTION VALUE="o5">Option 5
    <OPTION VALUE="o6">Option 6
    </SELECT>
    Option 1Option 2Option 3Option 4Option 5Option 6

    Hi,
    As you are tracking changes in ALV data you must define a event handler for ALV evenr ONDATA_CHECK.
    On defining an event handler you will be getting a structure called t_param.
    It contains an element called t_deleted rows.
    See this code to have an idea.
    method ONDATACHECK .
      DATA: x_delete_row LIKE LINE OF r_param->t_deleted_rows.
      "      i_addr_factr TYPE STANDARD TABLE OF ycot_addr_factr,
       "     x_addr_factr LIKE LINE OF i_addr_factr.
    TYPES t_proj_constr TYPE ycot_proj_constr.
      FIELD-SYMBOLS: <fs_row> TYPE t_proj_constr.
      IF wd_comp_controller->ya_optyp = 'DELETE'.
        LOOP AT r_param->t_deleted_rows INTO x_delete_row.
          "x_addr_factr ?= x_delete_row-r_value.
          ASSIGN x_delete_row-r_value->* TO <fs_row>.
        DELETE FROM ycot_proj_constr  WHERE plant = <fs_row>-plant
                                     AND   yr_nbr = <fs_row>-yr_nbr
                                     AND   period = <fs_row>-period
                                     AND  billback_pr_fmly = <fs_row>-billback_pr_fmly
                                     AND  prd_nm = <fs_row>-prd_nm.
      ENDLOOP.
    I hope it helps.
    Regards,
    Sumit Oberoi

  • Bug while saving multi select list

    Hi,
    My requirement is to construct a region where user can select their answer from available option. answer field can be multiple select/single select or text area.
    I have written below query to achieve different type of answer field.
    /**query****/
    DECLARE
    v_sql VARCHAR2 (32767);
    v_answer VARCHAR2 (32767);
    v_main_sql VARCHAR2 (32767);
    BEGIN
    FOR cur IN (SELECT question_id, question, answer_type, available_answer FROM question WHERE status= 'ACTV')
    LOOP
    v_sql := 'SELECT ';
    v_sql := v_sql || ' APEX_ITEM.hidden(4,question_id)||question question, '; /*do not show question id as per requirement*/
    IF cur.answer_type = 'MS' -- Multi Select List
    THEN
    v_answer := cur.available_answer;
    v_sql :=
    v_sql
    || ' APEX_ITEM.SELECT_LIST_FROM_QUERY(3,null,''SELECT * from table(
    AU_F_LOV_FN('''''
    || v_answer
    || '''''))'',''class="multiselect" multiple="multiple"'',''NO'') Answer ';
    ELSIF cur.answer_type = 'SS'
    THEN -- Single Select List
    v_answer := cur.available_answer;
    v_sql :=
    v_sql
    || ' APEX_ITEM.SELECT_LIST_FROM_QUERY(3,null,''SELECT * from table(
    AU_F_LOV_FN('''''
    || v_answer
    || '''''))'') Answer ';
    ELSE -- Free text
    v_sql := v_sql || ' apex_item.textarea(3,available_answer,2,20) Answer ';
    END IF;
    v_sql := v_sql || ' from question ';
    v_sql := v_sql || ' where question_id=' || cur.question_id;
    IF v_main_sql IS NULL THEN
    v_main_sql := v_sql;
    ELSE
    v_main_sql := v_main_sql ||' UNION ' || v_sql;
    END IF;
    END LOOP;
    RETURN v_main_sql;
    END;
    /***end of query***/
    If I select two options from multiple select list it is saving two records into table instead of saving one record with colon delimeter.
    /**query to save**/
    FOR i IN 1 .. APEX_APPLICATION.G_F03.COUNT
    LOOP
    IF APEX_APPLICATION.G_F03(i) IS NOT NULL THEN
    UPDATE question_answer
    SET answer = v_answer
    WHERE question_id = APEX_APPLICATION.G_F04(i)
    and call_id=p_sourceid;
    IF sql%rowcount =0 then
    INSERT INTO question_answer (question_id,
    answer,
    call_id,
    status,
    customer_id)
    VALUES (APEX_APPLICATION.G_F04(i),
    nvl(v_answer,APEX_APPLICATION.G_F03(i)),
    p_sourceid,
    'ACTV',
    p_customer_id);
    END if;
    END IF;
    END LOOP;
    /**End**/
    Can anyone please help me? Why is it happening? How to tweak my query so that it saves one record with colon delimeter.

    Technically, my understanding is that a Shuttle is just two multiselect lists where javascript moves the items from one to the other. Technically its the same thing, just different presentation and methods for selection. When you go to process, its seen the same way as you initially had your code setup so no code changes would have been necessary. As it's a built in item type and with APEX's backwards compatibility policies, if your code works now it should continue to work.

  • How to create a multi select drop down filed in crm 7.0

    Hi All,
            I need to create a multi select drop down field in crm web ui where one field have 7 value and we can select more than one value at a time.I have no idea how to create a multi select drop down field in web ui.
    Please help.....

    Hi vishwas
    Please follow the thread where a similar requirement was posted.
    Re: Drop-down list box / pick-list with multiple selections at a time
    Here the suggestions say that a workaround could be to associate a table view to the field.
    Regards,
    Nisha

Maybe you are looking for