Sorting JTab disables row selection

In a scroll panel I inserted a Jtable that shows view data. Sorting works by double-clicking the column header. After sorting however rows cannot be selected, sometimes the table gets reorganized again.
How can I allow a row to be selected after sorting as described above?
Thank you.

This is the way the sort model was designed. I filed an enahncement request.
Frank

Similar Messages

  • ALV - problem to disable row selection (SET_ROW_SELECTABLE)

    Hi,
    I'm using an (non editable) ALV with a supply function to display details to each line.
    I have to buttons "New" and "Modify" to insert a new line or to modify an existing row (in the details).
    This works fine.
    Now what I want to do is, if the user press one of the buttons "New" or "Modify", I want to disable the row selection of the ALV, so the user can't select another row during inserting or editing.
    For this, I've implemented in the WDDOMODIFYVIEW of the view the coding to enable or disable the row selection
    lo_value->if_salv_wd_table_settings~SET_ROW_SELECTABLE( ABAP_TRUE ).
    * or
    lo_value->if_salv_wd_table_settings~SET_ROW_SELECTABLE( ABAP_FALSE ).
    In case of "New" this works fine. The row selection is disabled.
    But not in case of "Modify".
    There is a strange behaviour:
    The row selection is not completely disabled. It looks like you can select rows, but if you select another row, it is automatically jumping to the first row and also the details is updated to the first row.
    The different between "New" and "Modify" is, that in "New", I create a new element in the ALV.
    Than it works correct. If I do the same in "Modify", I have the same correct behavior.
    But of course, I don't want to insert a new row in my "modify" mode.
    So maybe it has something todo with set lead selection?
    Maybe I do something wrong or that is a problem in the abap release. But I can't find anything in OSS.
    Thanks in advance!
    Andreas

    Hi,
    I would like to propose another approach here,
    I assume that ALV is in read only mode.
    1. User select the row and press the "Modify" button. As soon as user press the modify button "disable" the Modify and New button.
    2. Once the user is finish with the changes and press save. Enable the new and modify button.
    3. Without saving if user select anyother row then raise the "Save" confirmation popup with Yes, NO and Cancel button.
    4. If User press the New button then add new row and disable the "New" and "Modify button". Follow the Step 2 and 3 for this case also.
    I hope this will give you some idea.
    Thanks,
    Rahul

  • ALV disable row selection

    Hai gurus,
    In my ALV output I want to disable the left most button (Row selector) for some reasons Dynamically.
    The user should not select the entire row for some condition.
    loop at itab.
         If itab-field1 eq 'AA'.
             Disable row for selection.
         endif.
    endloop.
    Thanks in advance .....

    Hi Shridhar,
    I think it is difficult to have selection boxes on some condition.
    We can have only one type of selection mode for alv.
    Kindly refer following link for your solution
    http://help.sap.com/saphelp_47x200/helpdata/en/ef/a2e9eff88311d2b48d006094192fe3/frameset.htm
    I have tried it in many ways but not able to have its solution.
    Kindly share it with all of us if you get the solution.
    Hope it helps,
    Pratik Vora
    Edited by: Pratik Vora on Feb 23, 2009 11:23 AM

  • Disable row selection for certain column in JTable

    I have a JTable with several columns, one of which contains an "Info" button. I already have it worked out that when I click on the "Info" button, that event gets passed from the JTable to the button. I have multi-select enabled for the JTable, but I don't want clicking on the "Info" button to change the current selection. I have a klugy "fix" working where I save off the current selection, and then restore it after the user presses the "Info" button. However, this results in "flashing" - the row containing the selected "Info" button becomes selected briefly, then the original selection is restored. How can I avoid this? I would like to just ignore selection events on the "Info" column, but still pass the mouse click event through to the button.
    Any suggestions?

    try this
            JTable table = new JTable() {
                public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend) {
                    if (!getColumnModel().getColumn(columnIndex).getIdentifier().equals("Info")) {
                        super.changeSelection(rowIndex, columnIndex, toggle, extend);
                    }//else

  • Jtable - disable mouse selection

    hello,
    i did like to disable row selection in a jtable by mouse.
    in fact, the user should not be able to select rows in the table, but programmatily it should work.
    any ideas?
    thank you
    greets
    lukas

    You could try removing all the MouseListeners from the table. I don't know what other functionality you would lose.
    MouseListener[] listeners = (MouseListener[])table.getListeners(MouseListener.class);
    for (int i = 0; i < listeners.length; i++)
         table.removeMouseListener( listeners[i] );

  • ALV Grid multiple row selection, disabling some

    Does anyone know if it is possible to have an ALV grid with multiple row selection allowed but for some rows the row selection is disabled?
    Kind regards,
    John.

    Hi John,
    You can add a check box and select multiple rows. I am using the same technique. I have used OO.
    a) Use Even handler "Double Click"
    b)Using "SELECT_ALL_ENTRIES  CHANGING PT_OUTTAB TYPE STANDARD TABLE" and I am sorting based Check box selection.
    Need more help please let me know. I will send you the code.
    Lanka
    Message was edited by: Lanka Murthy

  • Disabling resize on row selected column in DataGridView

    Hi,
    In my application, I have managed to disable resizing of my data columns on my DataGridView, but the only column that I cannot disable the resize feature is on the row select column, you know, the one which shows which row is currently selected (also shows the little pencil when the line is being edited).
    Can someone help me identify how to disable this please? I'm using VS2005 pro and C#.
    I'm doing this programmatically because my program uses many different databases. I currently do things like:
    this.myDataGridView.Columns["LineIndex"].width = 100;
    this.myDataGridView.Columns["LineIndex"].Resizable = DataGridViewTriState.False;
    Can I do the same sort of thing to fix the width of the row selection column? I don't want to hide it, just stop the resizing of this column!
    Thanks
    Sean

    This option disables columns re-sizing at all, also if property AllowUserToResizeColumns =True ...Did you know how can I to enable to user to resize all columns, except "selector column" (the column with the arrow)? Thanks

  • Is it possible to enable/disable table row selection?

    I have a situation where a user can add rows to a "selection" table with a value that is used to perform a query to get a collection of objects associated with that value. Once those objects are available, a second "results" table will be populated with the row(s) returned. When the value is entered in the selection table, a web service call is made to perform the query and return the results. This may take a few moments and I am displaying an indeterminate progress indicator for the selection table row involved to indicate that the data is not yet available - the progress indicator is included as a column in the row; each row has its own indicator. Once the results are received the indicator is hidden to indicate the query for that row has completed. The user may enter as many rows in the selection table as they wish so there is a distinct possibility of multiple queries being executed at a given time. I have also attached a row selection listener to the selection table such that when a given row is selected, the results table will display the corresponding associated row(s).
    What I'd like to be able to do is somehow temporarily disable the selection of any row that has a query in progress, while leaving other rows whose queries have completed be selectable. Once the query completes, the row can then become selectable, thus allowing for the results to be loaded and displayed in the results table. The way it works right now, if the row is selected while the query is still in progress, nothing is displayed (obviously), but then the row has to be re-selected after the query has completed to see the results. This is a viable (though undesirable) solution/workaround if there is at least one other row in the table. However, if the row is the only row in the table and has been selected, it cannot be re-selected (there's no other row to select to allow for re-selection). To boil it down, what I'd like to do is prevent the selection of the row until the query for that row is complete.
    After perusing the JavaFX 2.2 API, I'm not seeing any obvious way to achieve this effect. If anyone has any solutions, suggestions, etc. on how this could be done I'd appreciate it greatly.

    Here's an [url https://github.com/james-d/Conditionally-selectable-table]example. As predicted, keyboard navigation fails if the keyboard presses would result in an unselectable item being selected using the default selection model. The best workaround I can see for this is to register event filters for the appropriate keyboard strokes, as in the previously referenced thread.
    Update: That code won't run in the current (ea b90) release of JavaFX 8.0, and probably a few recent releases; it will however run in the final release (and it runs in JDK 7). See [url https://javafx-jira.kenai.com/browse/RT-30593]RT-30593
    Edited by: James_D on May 22, 2013 7:51 PM

  • Disabling multiple row selection in JTable

    hi,
    I have a JTable and I want to disable the multiple row selection.
    I used
    getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);and this working fine with ctr+clicking on a row
    but if i am using shift key instead of Ctrl key multiple selection is possible....
    Any idea y?and how to resolve it??
    thnx
    ~neel

    Use table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);I don't know if it differs but I use it and I don't have the problems you describe. Might be a bug in your Java version?!
    Message was edited by:
    pholthuizen

  • Disable DataGrid row selection for a column?

    Hi,
    I have a DataGrid with a CheckBox in one column. When the CheckBox itself is clicked, or any point in the CheckBox column
    is clicked, I *don't* want the grid row selected. IOW, row selection should be disabled for the column. How to get this behavior?
    Thanks, Garry

    Hi All,
    I do have almost similar requirement where I have image overlay-ed on row, on whose click a context menu should appear but row should not get selected.
    Row selection should happen if user clicks elsewhere on that row (apart from overlayed image).
    I tried below lines in MouseClick event listeners.
    event.stopImmediatePropagation();
      event.stopPropagation();
    Above lines stopped itemClick event but didnt prevent the row selection.
    Regards,
    Pavan

  • How to disable first row selection in a table

    Hi,
    I have three tables which have master child relationship. I need to enable a button for each table based on row selection of corresponding table.But first row is being selected automatically and the buttons are enabled.
    what should i do in order to avoid first row selection in a table.I tried by removing selected Row Keys.But still i am getting the same problem.can anyone suggest on this.
    Thank You,
    Sukumar

    I know a hack but I don't recommend it, anyway here it goes:
    Remove selected Row Keys
    Change selectionListener from the default and create a custom action listener (You can call the default one inside of it) (Tip: use makeCurrent function in this PDF
    This will make sure that there is no selected row highlighted for the first time, but it actually means that the first row is selected, it's just not shown.
    This method is tested with 11.1.1.7

  • Row Selection

    Hi all,
    I have a data table and if a row is selected I want it to load a different JSF page. I want to use the row selection feature as the highlighting aspect is useful. However, row selection seem to me to only link to a listener, so I can load parts of the current page based on a row selection but not issue a command to take me to another page. Currently I have had to disable the row selection and just stick an icon at the start of the which is an commandImageLink.
    Is there a way to perform a action when a row is selected? I hope I'm missing something obvious as this would seem to me to be quite a common thing. Maybe its not there? is there a way to achieve this functionality? Maybe some sort of request dispatched in the selection listener method?
    Cheers,
    Dale

    Hi John, thanks for reply, don't understand how though? I have a rough idea of how to use the selectionlistener as I have used it in a few places but not to jump to another page, so I have tried just changing return type from void to String but that does link away...
        public String LoadTask(SelectionEvent selectionEvent) {
            RichTable table = (RichTable)selectionEvent.getComponent();
            Task selectedTask = (Task)table.getSelectedRowData();
            // to some stuff
            return "showTask"
        }So what I want to do is navigator to "showTask" when I select a row but I just can't see a mechanism to do that?
    Table looks like this...
                    <af:table value="#{Tasklist.taskList}" var="row"
                              rowBandingInterval="1" id="t1" rowSelection="single"
                              disableColumnReordering="true" emptyText="No tasks matching criteria"
                              fetchSize="#{Tasklist.pagingData.rowsPerPage}"
                              partialTriggers="::cb1 ::cb2 ::cb3 ::cb4"
                              immediate="true"
                              sortListener="#{Tasklist.SortTasklist}"
                              selectionListener="#{Tasklist.LoadTask}">
                        <af:column frozen="true" id="sel" headerText=" " width="30">
                            <af:commandLink id="loadLink" action="#{Tasklist.loadTask}" text="Load">
                              <f:param id="tskId" name="taskId" value="#{row.systemAttributes.taskId}"/>
                            </af:commandLink>
                        </af:column>
                        <af:forEach items="#{Tasklist.columnsMetaData}" var="colDef">
                            <af:column sortable="true" sortProperty="title" headerText="#{colDef.headerText}" align="start" id="dataCol">
                              <af:outputText value="#{ExprBean[colDef.valueBinding]}" id="ot4"/>
                            </af:column>
                        </af:forEach>
                    </af:table>I want to do away with that Load column but just can't seem to do it with row selection :o(
    Cheers,
    Dale

  • How to avoid table refresh on row selection

    Hi,
    I have a table where the row selection happens on selecting the check box in the first column of the row. The check box is bound to the transient Boolean attribute of my VO to support this functionality which is missing in new version of ADF. The selection is working fine, however I am facing the issue with table refresh. Everytime I click checkbox to select or unselect a row my whole table is getting refreshed which is very unusual for user point of view. This is my code for the checkbox column:
    <af:column sortProperty="isSelected" sortable="true"
    headerText="#{bindings.pricingObjects.hints.isSelected.label}"
    id="c4"
    inlineStyle='#{(row.isSelected)?"background-color: #E7E7E7":""};'>
    <af:selectBooleanCheckbox value="#{row.bindings.isSelected.inputValue}"
    required="#{bindings.pricingObjects.hints.isSelected.mandatory}"
    shortDesc="#{bindings.pricingObjects.hints.isSelected.tooltip}"
    id="it4" simple="true"
    autoSubmit="true">
    <f:validator binding="#{row.bindings.isSelected.validator}"/>
    </af:selectBooleanCheckbox>
    I have to keep autoSubmit="true" on selectBooleanCheckbox because the table has to change color of the row everytime the checkbox is selected or deselected. Also, there are multiple commandToolbarButton such as "Delete" which needs to be enabled/disabled depending on the row selection.
    Is there anyway, I can achieve this behaviour with minimal refresh of table?

    Hi Marge,
    Yes I do have Add and Delete toolbar button in the panelCollection and also set partialTrigger="tableId" on them. I need this partialTriggers because Delete button should enable/disable depending on number of rows added in the table. However, I tried removing them but it did not work for me, table is still refreshing. BUT this solution does work in combination of other solution i.e. removing ChangeEventPolicy="ppr" on the iterator. I need ppr because I have a form which is bound to the same iterator and should change on table selection. The design is like this,
    - Read-only Table on top
    - Editable Form below
    - Select the row in table and edit the fields in the form
    If I remove ppr then my form is not updating with the row selection.
    Regards,
    Afroz

  • Af:fileDownloadActionListener picks wrong filename for the first time after row selection.

    Hi,
    I am using Oracle Jdeveloper 11g release 1. In one of my jspx pages i have a table, i can select one of the row and click on a button which invokes fileDownloadActionListener. The code of jspx is as below:
    <af:commandMenuItem text="#{coregccomplianceuiBundle.MENU_EXPORT}"
                                        id="CS19" partialSubmit="true"
                                        actionListener="#{viewScope.core_gccompliance_cs_librarybean.validateExport}"
                                        partialTriggers="CSftLib"
                                        disabled="#{viewScope.core_gccompliance_cs_librarybean.exportDisabled}">
    </af:commandMenuItem>
    <!--This button is set hidden, which is used to deal with the download job.
        The Export button on the page only does the validation. (whether it's a system defined standard)-->
      <af:commandButton text="#{coregccomplianceuiBundle.BTNEXPORTHIDDEN}" id="csl_csExportHidden"
                                          clientComponent="true" visible="false"
                                          partialSubmit="false">
    <af:fileDownloadActionListener contentType="application/x-download" 
                                          method="#{viewScope.core_gccompliance_cs_librarybean.handleExport}"
                                          filename="#{viewScope.core_gccompliance_cs_librarybean.fileName}"/> 
    </af:commandButton>
      /** force the ExportHidden Button to do export */
        function csExportHandler(event) {
            var exportCmd = AdfPage.PAGE.findComponent("emT:CS4:csl_csExportHidden");
            var actionEvent = new AdfActionEvent(exportCmd);
            actionEvent.forceFullSubmit();
            actionEvent.noResponseExpected();
            actionEvent.queue();
    The bean methods used in above block are as below:
    public void validateExport(ActionEvent actionEvent) {
           // checks if entity is system defined and shows error popup if it is .
            if (checkIsSystem())
                return;
            //Handle the export    
            AdfUtil.addScript("csExportHandler()");
    public void handleExport(FacesContext context, OutputStream out) {
            ComplianceLibraryAMImpl am = getDataController();
            HttpServletRequest request =
                (HttpServletRequest)context.getExternalContext().getRequest();
            Locale locale = NLSUtil.getClientLocale(request);
            ResourceBundle rb =
                ResourceBundle.getBundle("oracle.sysman.core.gccompliance.view.CoreGccomplianceUiMsg",
                                         locale);
            PreparedStatement st =
                am.getDBTransaction().createPreparedStatement("commit", 1);
            Connection conn = null;
            boolean isAgentSideCs = false;
            try {
                conn = st.getConnection();
                RichTable oTable = getCsTable();
                fileName = "ComplianceStandard.xml";
                List<Raw> exportGuids = new ArrayList<Raw>();
                for (Object opaqueFacesRowKey : oTable.getSelectedRowKeys()) {
                    oTable.setRowKey(opaqueFacesRowKey);
                    Object o = oTable.getRowData();
                    JUCtrlHierNodeBinding rowData = (JUCtrlHierNodeBinding)o;
                    exportGuids.add((Raw)rowData.getRow().getAttribute("CsGuid"));
                    int csType = ((oracle.jbo.domain.Number)rowData.getRow().getAttribute("CsType")).intValue();
                    if(csType == 4)
                        fileName =
                                (String)rowData.getRow().getAttribute("CsDname") + ".zip";
                        isAgentSideCs = true;
                    else
                        fileName =
                                (String)rowData.getRow().getAttribute("CsDname") + ".xml";
                    if(((Integer)rowData.getRow().getAttribute("IsSystem")).intValue() == 1){
                        throw(new ParseException(50));
                if (exportGuids.size() > 1)
                    fileName = "Compliancestandard_list.xml";
                RAW guid = new RAW(exportGuids.get(0).toString());
                if(isAgentSideCs)
                    getDataController().exportStandardContent(conn, out, guid);
                else
                    CsExport csexport = new CsExport(false);
                    csexport.doCsExport(conn, guid, false, out);
            } catch (ParseException e) {
                String errMsg = "";
                String errHdr = "";
                if(e.getStatus() == 50){
                    errMsg = rb.getString("ERRMSG_ISSYSTEMENTITY_EXPORT");
                    errHdr = rb.getString("ERRHDR_ISSYSTEMENTITY_EXPORT");
                else{
                    errMsg = rb.getString("ERRMSG_EXPORT_CS");
                    errHdr = rb.getString("ERRHDR_EXPORT_CS");
                AdfUtil.showMessageDialog(null, AdfUtil.MESSAGE_TYPE.ERROR, errHdr,
                                          errMsg, false, null);
                throw new RuntimeException(e);
            } catch (SQLException e) {
                throw new RuntimeException(e);
            } finally {
                JDBCUtil.close(st);
            MimeUtil mimeUtil = new MimeUtil();
            mimeUtil.downloadFile(context, fileName);
            try {
                out.flush();
                out.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
    Class MimeUtil:
    public void downloadFile(FacesContext context, String fileName) {
            HttpServletResponse httpServletResponse =
                (HttpServletResponse)context.getExternalContext().getResponse();
            HttpServletRequest httpServletRequest =
                (HttpServletRequest) context.getExternalContext().getRequest();
            String unicodeFileName = fileName;
            String agent = httpServletRequest.getHeader("USER-AGENT").toLowerCase(Locale.US);
            boolean isIE = false;
            if (null != agent && -1 != agent.indexOf("msie"))
                isIE = true;
            //encode the output file name to support NLS
            unicodeFileName = MimeUtil.encodeFileName(fileName, isIE);
            httpServletResponse.setHeader("Content-disposition",
                                          "attachment;filename=\"" + unicodeFileName +
    httpServletResponse.setContentType("application/x-download");
            context.responseComplete();
            httpServletResponse.setContentType("application/x-download");
            context.responseComplete();
    Now when i come to the page for first time and select a row and click on Export then the filename that gets shown in save file dialog is incorrect (it shows partial adf taskflow name) , but when i select the row again by clicking on any other row and click export it shows correct filename i.e. selectedRowName.zip or .xml according to type of row selected.
    Can anybody suggest what am i missing?

    difficult to tell like this.but better you debug your code then you can get where you getting filename wrong.

  • Next row in JTable (skip disabled rows)

    When I press the down button on my keyboard how can I move to the next available row. It should skip all disabled rows.
    My subclass of JTable looks like this:
    public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend) {
    if (list[rowIndex].isEnabled()) {
    super.changeSelection(rowIndex, columnIndex, toggle, extend);
    All the disabled rows is not selectable. Right now it just stop when the next row is disabled.

    Well, I think the right way to it would be something like..
    public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend)
         // Get to the right row..
         while (!list[rowIndex].isEnabled())
              ++rowIndex;
              rowIndex %= list.length;
         // Change selection to the row found.
         super.changeSelection(rowIndex, columnIndex, toggle, extend);
    The last one is good asuming there must be at least one enabled row, otherwise you should handle this case also...

Maybe you are looking for

  • Menu bar in ALV OOPS

    HI All , I am using the method SET_TABLE_FOR_FIRST_DISPLAY of class CL_GUI_ALV_GRID  for a report program . In the Menu bar I have  SYSTEM and HELP  by default But in  REUSE_ALV_GRID_DISPLAY  in Menu bar we have LIST  EDIT GOTO SETTINGS other than SY

  • How can I refune a game I download a game but I gave them my money I didn't want to go e how can I refune it?

    I need help how to refune the money I like the game but I didn't want to use money on it can u please help me stop it before they take the money thank u:)

  • Ipod out of wack

    wont let me press the v key and also other keys. keeps on pressing wiwi on its own on my ipod touch.

  • Add report assignment to AR01 (Asset Balances)?

    AR01-Asset Balances can be drilled-down to Asset Explorer (AW01N) via report interface/assignment.  Can we add report assignment AS03 to report AR01? For reports developed using Report Painter/Writer, we cannot change SAP-delivered reports/report gro

  • P2V Server using Bootable media

    I have a server that cannot boot fully into Windows. I want to boot off a CD and create a VHD of the server on a USB drive or network drive. I'm hoping someone can point me in the right direction of how I can do this quickly and easily. Vincent Sprag