How to select a specific cell in a JTable?

Hi there,
in a JTable, I would like to select a specific cell (to highlight it) from a JButton.
Here a sample code...
Who could help me to fill it?
import java.util.*;
import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;
import java.awt.event.*;
public class TableSelection{
    public static void main (String args[]) {
      JFrame frame = new MyFrame();
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.show();
class MyFrame extends JFrame{
  public MyFrame(){
    setTitle("TableSelection");
    setSize(WIDTH,HEIGHT);
    DefaultTableModel myModel = new DefaultTableModel(2,2);
    JTable myTable = new JTable(myModel);
    myTable.setCellSelectionEnabled(true);
    JButton button00 = new JButton("select 0,0");
    button00.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent event){
     System.out.println("selection of cell (0,0)");
     //--- what code is required to select the cell(0,0)?
    JButton button11 = new JButton("select 1,1");
    button11.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent event){
     System.out.println("selection of cell (1,1)");
     //--- what code is required to select the cell(1,1)?
    Box myBox = new Box(BoxLayout.Y_AXIS);
    myBox.add(new JScrollPane(myTable));
    myBox.add(button00);
    myBox.add(button11);
    getContentPane().add(myBox, BorderLayout.CENTER);
  private static final int WIDTH=200;
  private static final int HEIGHT=200;
}Thanks a lot for your help.
Denis

Use the addColumnSelectionInterval(int index1, int index2)method ~ http://java.sun.com/j2se/1.4/docs/api/javax/swing/JTable.html#addColumnSelectionInterval(int,%20int)
and the addRowSelectionInterval(int index1, int index2) method ~ http://java.sun.com/j2se/1.4/docs/api/javax/swing/JTable.html#addRowSelectionInterval(int,%20int)
Hope that helped.
afotoglidis

Similar Messages

  • How to print a specific cell in numbers

    how to print a specific cell in numbers?

    Copy the cell (contents), Paste onto a page of a separate document, or onto a separate sheet of your Numbers document, Print.
    Or insert a single cell table onto your Numbers document, type an = sign in the cell then click on the cell you want to print. Drag the new table to a second sheet, set up your page there, and print.
    See the Numbers '09 User Guide for other useful tools and techniques. Download the guide via the Help menu in Nuimbers.
    Regards,
    Barry

  • How to: Select a Specific Timeline Displayed in Project Online when having multiple timelines within the Enterprise Project

    Currently I have an Enterprise Project which has 6 custom timelines and I want to know how to select a specific timeline to be displayed on the Project specific SharePoint site.
    I'll provide some background for you so you understand my issues... I have created a "template" project with 6 custom timelines. From that project I created multiple new projects - which they all have the 6 custom timelines. These projects are
    all stored in the Project Center. The problem I am having is I don't understand how to select a specific timeline to show on the project specific SharePoint site. They all seem to be displaying 1 of the 6 timelines (in no particular order). I was thinking
    maybe if I had edited a project and saved it while it was displaying a specific timeline it would display the last selected timeline on the SharePoint site, but it doesn't seem to be doing that.
    Is there a way to select a specific timeline to display on the SharePoint site?  Also, is there a way for a user to cycle through the numerous timeline view on the project specific SharePoint site?
    I await your help!! :)

    Michelle_Sm --
    I ran into this problem at the company where I used to work.  One of our PMs had created multiple Timeline views, and wanted a specific custom Timeline view to show up in the Project Site for that project.  I could not see any way to make that
    happen.  We had one of our SharePoint developers look into the issue, and he could not see any way to make this happen either.  So, I am thinking this is not possible to do.  But I would gladly welcome others in this forum to tell us the trick,
    if there is one!  :)  Hope this helps.
    Dale A. Howard [MVP]

  • How can I link specific cells in two different speadsheets so the data from a specific cell in spreadsheet A automatically updates in a specific cell in spreadsheet B. It works in Xcel- Any ideas?

    How can I link specific cells in two different tables so the data from a specific cell in table A automatically updates in a specific cell in table B? It works in Xcel- Any ideas?

    (1) your title ask the way to link different spreadsheets.
    In Numberland, a spreadsheet is an entire document.
    There is no way to link different documents.
    (2) in the message, you ask the way to link different tables.
    This feature is available and is described in iWork Formulas and Functions User Guide (which is available for free from the Help menu).
    Getting the info just requires a simple search in this available resource !
    Yvan KOENIG (VALLAURIS, France) 14 mai 2011 10:37:50

  • How to select a specific column in a bean method?

    Hey everyone,
    I'm trying to select a specific column in my adf table so i can hightlight the ones i can after, with a method bean that does a match from another table. I'm using JDeveloper 12.1.2.0.0.
    Here's my table at the moment (its a static list that Timo and Alejandro helped me create, thanks to them again!):
    <af:table value="#{bindings.Anos1.collectionModel}" var="row"
                                                              rows="#{bindings.Anos1.rangeSize}"
                                                              emptyText="#{bindings.Anos1.viewable ? 'No data to display.' : 'Access Denied.'}"
                                                              rowBandingInterval="0" fetchSize="#{bindings.Anos1.rangeSize}"
                                                              filterModel="#{bindings.Anos1Query.queryDescriptor}"
                                                              queryListener="#{bindings.Anos1Query.processQuery}"
                                                              filterVisible="false" varStatus="vs" id="t5"
                                                              styleClass="AFStretchWidth" columnSelection="multiple"
                                                              inlineStyle="max-width:100%;" columnStretching="multiple"
                                                              columnSelectionListener="#{ControlBean.onAnoColumnSelect}"
                                                              disableColumnReordering="true"
                                                              binding="#{ControlBean.dimAnos}">
                                                        <af:column sortProperty="#{bindings.Anos1.hints.A2011.name}"
                                                                   filterable="true" sortable="false"
                                                                   headerText="2011"
                                                                   id="c54" width="16%">
                                                            <af:outputText value="#{row.A2011}"
                                                                           shortDesc="#{bindings.Anos1.hints.A2011.tooltip}"
                                                                           id="ot54">
                                                                <af:convertNumber groupingUsed="false"
                                                                                  pattern="#{bindings.Anos1.hints.A2011.format}"/>
                                                            </af:outputText>
                                                        </af:column>
                                                        <af:column sortProperty="#{bindings.Anos1.hints.A2012.name}"
                                                                   filterable="true" sortable="false"
                                                                   headerText="2012"
                                                                   id="c55" width="16%">
                                                            <af:outputText value="#{row.A2012}"
                                                                           shortDesc="#{bindings.Anos1.hints.A2012.tooltip}"
                                                                           id="ot55">
                                                                <af:convertNumber groupingUsed="false"
                                                                                  pattern="#{bindings.Anos1.hints.A2012.format}"/>
                                                            </af:outputText>
                                                        </af:column>
                                                        <af:column sortProperty="#{bindings.Anos1.hints.A2013.name}"
                                                                   filterable="true" sortable="false"
                                                                   headerText="2013"
                                                                   id="c56" width="16%">
                                                            <af:outputText value="#{row.A2013}"
                                                                           shortDesc="#{bindings.Anos1.hints.A2013.tooltip}"
                                                                           id="ot56">
                                                                <af:convertNumber groupingUsed="false"
                                                                                  pattern="#{bindings.Anos1.hints.A2013.format}"/>
                                                            </af:outputText>
                                                        </af:column>
                                                    </af:table>
    I've deleted some of the columns because they are all equal and by doing so, you have less problems in reading it.
    In my method i have a matchEm but i'm trying to select a column by using this line:
            dimAnos.setColumnSelection("A2012");
    dimAnos is the binding for my table Anos (Years in Portuguese). I even tried another values fro the columnSelection but i couldn't make it selected. Am i doing anything wrong?
    Please help me or give me an idea of how can i do this.
    Regards,
    Frederico.

    Hi Frederico,
    The method setColumnSelection is meant to set whether your table supports column selection or not. It doesn't select the column. In order to select the column, you need to set the column attribute Selected to true. So I don't know if its an option for you but you can create a binding to all the columns you have in you bean, and then call the method A2012.setSelected(true), and then add a partial target to the table to re render it and show the selected column.
    Hope this helps

  • How do I sort specific cells without affecting entire rows?

    In Excel I can sort specific cells ascending/descending and only what I highlight will sort.
    In Numbers, when I try to do that the entire row sorts.
    Is there a way to only sort the highlighted cells and not have the rest of the rows sort as well?

    Here's a link (Dropbox download) to a Copy Sort Acending service, that in your menu would look similar to this:
    To use it, select the cells you want to sort, just as in Excel, and make the choice from the menu.
    After that, unlike Excel, click once in the first cell where you want the sorted values to start appearing (either the original range, or a different range if you want) and type command-v or option-shift-command-v to paste.
    The one-time installation takes a double-click on the .workflow package and a click on 'Install'. You may also have to go to System Preferences > Security & Privacy and click 'Download anyway'.  Installing simply moves the service to your Library > Services folder so that it will appear in your menu. It does nothing to the innards of your Mac, and does not run unless you specifically tell it to by choosing it from the menu or running it from within Automator. You can view the script by opening it in Automator.  You can remove the service if you don't need it by holding down the option key in Finder, choosing Go from the menu and navigating to Library > Services, where you can delete it the way you would any other folder or package.
    SG

  • How to select an individual cell in ALV.

    hi all,
    could anyone please tell me how do i select only one cell in a coloumn to perform the required operation on that cell.
    thanks.

    Hi Jagruti.
    If you search the forum with the key words: 'alv cell color' you will find the answer to
    this questions.
    Cheers,
    Sascha
    Message was edited by:
            Sascha Dingeldey

  • How to select a random cell in the DataGridView?

    Good day
    I am new to the DataGridView control. I was wondering if one can select a random cell in the DataGridView and if it is possible can someone help me with the code or a link to do it please.
    Thank you.

    Hi Arno du Toit,
    Use the following code, you can select the specilized cell.
    DataGridView1.CurrentCell = DataGridView1.Rows[rowindex].Cells[columnindex];
    Select a random Cell?
    Random rnd = new Random();
    int rowMax = DataGridView1.Rows.Count;
    int colMax = DataGridView1.Columns.Count;
    if(rowMax > 0 && colMax > 0)
    int row = rnd.Next(1, rowMax); //get the random row index
    int column = rnd.Next(1, colMax); //get the random column index
    DataGridView1.CurrentCell = DataGridView1.Rows[row].Cells[column];
    If you have any other concern regarding this issue, please feel free to let me know.
    Best regards,
    Youjun Tang
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to select a specific XML node with XPath

    Hi,
    I'm trying to a select a specific node from my XML data using the XPath Builder.  For example, say I have a process variable 'xmlData' with the
    following contents:
        User 1
        101
        User 2
        102
    I can successfully use the following expression to retrieve the name of
    a specific user:
    (/process_data/xmlData/users/user[userid='102'])/name
    The problem is I need to use another process variable for the selection
    key.  For Example:
    (/process_data/xmlData/users/user[userid=/process_data/@userId])/name
    But this always returns null.  I've tried surrounding /process_data/@userId
    with single quotes, double quotes, and event {$..$}. 
    Any help would be greatly appreciated.
    Thanks.

    Hi,
    Thanks for the quick replies.  I gave a bit of a bad example, as the
    userid in my data is really a string, not a number.
    A better example is:
        User 1
        user1
        User 2
        user2
    I can get the following to work perfectly:
    (/process_data/xmlData/users/user[userid='user2'])/name
    but I can't get it to work with
    /process_data/@userId = "user2"
    (/process_data/xmlData/users/user[userid=/process_data/@userId])/name
    Thanks.

  • How to select a particular row in a JTable?

    I want to select a particular row in a JTable. i.e something like
    table.setSelectedRow(arg)how can i do it.

    You can use
    table.getSelectionModel().setwhateverIsInTheAPI(...)
    depending on your selection mode.Thanx,
    but i don't want to change the selectionMode, i
    want to select a particular row thro program.
    This is like list.setSelected(index) in
    JListThe original poster was pointing you in the right direction. You have to use the SelectionModel when you want to work with the selected indexes of a JTable. It will return a ListSelectionModel, which will be an instance of DefaultListSelectionModel unless you implemented your own. Refer to the API for the appropiate method(s).
    http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/ListSelectionModel.html

  • How to Delete a Specific Cell in a Matrix + plz Give sample code for Lost F

    hello there !!!!
    i m in Great Trouble please help me out..
    i have to search for a specific Column n then i have to validate that portion, similarly after validating i have to add update delete all the fuction apply... so please help me i m very upset.
    Public Sub HandleEventts_Allowance(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef EventEnum As SAPbouiCOM.BoEventTypes, ByRef BubbleEvent As Boolean)
            Try
                Dim Count As Int32
                If FormUID.Equals("Allowance") Then
                    If (pVal.BeforeAction = True) And (pVal.ItemUID = "1") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK) Then
                        If pVal.Row = 0 Then
                            'BubbleEvent = False
                        End If
                        o_Matrix = SBO_Application1.Forms.Item(FormUID).Items.Item("MatAllow").Specific
                        Count = o_Matrix.RowCount()
                        SBO_Application1.MessageBox("Matrix Count is " & o_Matrix.RowCount)
                        Validate(pVal, EventEnum, FormUID, BubbleEvent)
                    End If
                End If
            Catch ex As Exception
                SBO_Application1.MessageBox(ex.Message)
            End Try
        End Sub
        Public Sub Validate(ByRef pval As SAPbouiCOM.ItemEvent, ByRef EventEnum As SAPbouiCOM.BoEventTypes, ByVal FormUID As String, ByRef BubbleEvent As Boolean)
            Dim Row, ii As Integer
            o_Matrix = SBO_Application1.Forms.Item(FormUID).Items.Item("MatAllow").Specific
            o_Matrix.FlushToDataSource()
            Try
                For Row = 2 To o_Matrix.RowCount
                    StrName = Convert.ToString(DBtable.GetValue("CardCode", Row - 1)).Trim()''' i got Error over there n rest of my code is also not working pls...
                    StrUId = Convert.ToString(DBtable.GetValue("U_AlwID", Row - 1)).Trim()
                    StrEnter = Convert.ToString(DBtable.GetValue("U_SupEnter", Row - 1)).Trim()
                    StrExist = Convert.ToString(DBtable.GetValue("U_SupExist", Row - 1)).Trim()
                    If Row - 1 < DBtable.Rows.Count - 1 Or (Not (StrName.Equals(String.Empty) And StrUId.Equals(String.Empty) And (StrEnter.Equals(String.Empty) Or StrExist.Equals(String.Empty))) And (Row - 1 = DBtable.Rows.Count - 1)) Then
                        If (Not StrName.Equals(String.Empty)) And ((StrUId.Equals(String.Empty) Or StrEnter.Equals(String.Empty)) Or StrExist.Trim.Equals(String.Empty)) Then
                            SBO_Application1.StatusBar.SetText("Invalid values provided!Blank values not vllowed", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
                            BubbleEvent = False
                            Exit Sub
                        End If
                        For ii = Row To DBtable.Rows.Count - 1
                            If Convert.ToString(DBtable.GetValue("ColName", ii)).Trim().Equals(StrName.Trim()) Then
                                SBO_Application1.StatusBar.SetText("Invalid Allowance ID: Duplication Not Allowed", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
                                oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE
                                BubbleEvent = False
                                Exit Sub
                            End If
                        Next
                        If CDbl(StrName) < 0 Then
                            SBO_Application1.StatusBar.SetText("Invalid values provided!Blank values not vllowed", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
                            BubbleEvent = False
                            Exit Sub
                        End If
                    End If
                Next Row
            Catch ex As Exception
                SBO_Application1.MessageBox(ex.Message)
            End Try
        End Sub

    Hello there
    sir i want to Add Update and delete these three basic operation onto the Matrix, Sir u game me a Sample code of Delete a specific Column...
    Sir can u do me a favour pls leave every thing n just told me how to update a matrix ,like i have to fill the matrix field through the DATABASE table now i want to update the DataBase table from the matrix..
    i just only know thta i have to fill back database table with the help of FLUSHTODATABASE()
    here is my Sample Code...n i have to update in the validate portion...
    Public Sub HandleEventts_Allowance(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef EventEnum As SAPbouiCOM.BoEventTypes, ByRef BubbleEvent As Boolean)
            Try
                Dim oCellValue As SAPbouiCOM.EditText
                If FormUID.Equals("Allowance") Then
                    If (pVal.ItemUID = "MatAllow") Then
                        If pVal.Row = 0 Then Exit Sub
                        o_Matrix = SBO_Application1.Forms.Item(FormUID).Items.Item("MatAllow").Specific
                        If (pVal.Row > o_Matrix.RowCount) Then Exit Sub
                        oForm = SBO_Application1.Forms.Item(FormUID)
                        If (pVal.ItemUID = "1" Or EventEnum = SAPbouiCOM.BoEventTypes.et_CLICK) Then
                            o_Matrix = SBO_Application1.Forms.Item(FormUID).Items.Item("MatAllow").Specific
                            If pVal.ColUID = "ColName" And pVal.BeforeAction = True Then
                                If pVal.Row = 0 Then Exit Sub
                                oCellValue = CType(o_Matrix.Columns.Item(pVal.ColUID).Cells.Item(pVal.Row).Specific(), SAPbouiCOM.EditText)
                                If (oCellValue.Value.Trim().Equals(String.Empty) And o_Matrix.RowCount <> pVal.Row) Then
                                    SBO_Application1.StatusBar.SetText("Invalid Allowance ID: Blank Value Not Allowed", )
                                    oCellValue.Active = True
                                    BubbleEvent = False
                                    Exit Sub
                                End If
                            End If
                        End If
                    End If
                End If
                Validate(pVal, EventEnum, FormUID, BubbleEvent)
            Catch ex As Exception
                SBO_Application1.MessageBox(ex.Message)
            End Try
        End Sub
    Public Sub Validate(ByRef pval As SAPbouiCOM.ItemEvent, ByRef EventEnum As SAPbouiCOM.BoEventTypes, ByVal FormUID As String, ByRef BubbleEvent As Boolean)
            Dim str, str1 As String
            Dim checkbox1, Checkbox2 As SAPbouiCOM.CheckBox
            Dim o_Matrix As SAPbouiCOM.Matrix
            Dim Sum As Integer
            Dim oRecordset As SAPbobsCOM.Recordset
            Dim Container As Integer
            Dim Count As Int32
            o_Matrix = SBO_Application1.Forms.Item(FormUID).Items.Item("MatAllow").Specific
            oRecordset = o_CompanyObj.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
            Try
                For Count = 0 To DBtable.Rows.Count - 1
                    CodeFill = Convert.ToString(DBtable.GetValue("Name", Count).Trme())
                    NameID = Convert.ToString(DBtable.GetValue("ColUID", Count).Trim())
                    Price = Convert.ToString(DBtable.GetValue("ColPrice", Count).Trim())
                    Quantity = Convert.ToString(DBtable.GetValue("ColQuant", Count).Trim())
                    Total = Convert.ToString(DBtable.GetValue("ColTotal", Count).Trim())
                    checkbox1 = o_Matrix.Columns.Item("ColSEnter").Cells.Item(Count).Specific
                    Checkbox2 = o_Matrix.Columns.Item("ColSExist").Cells.Item(Count).Specific
                    If (checkbox1.Checked = True) And (Checkbox2.Checked = True) Then
                        Dim Sql As String
                        Sql = "Update [@Supplier] Set U_Price=' " & Price & " ',U_ID=" & NameID & "Where Name ='" & CodeFill & " '"
                        oRecordset.DoQuery(Sql)
                    End If
                Next Count
                SBO_Application1.MessageBox("Record was Updated")
            Catch ex As Exception
                SBO_Application1.MessageBox(ex.Message)
            End Try
        End Sub

  • How to color a specific cell in ALV (not REUSE_ALV_GRID_DISPLAY)

    Hi
    I want to change color font or background to a specify position in ALV grid
    It is possible but by creating ALV container (not FM for example REUSE_ALV_GRID_DISPLAY)?

    Hi,
    REPORT ZALV_LIST1.
    TABLES:
    SPFLI.
    TYPE-POOLS:
    SLIS.
    PARAMETERS:
    P_COL TYPE I ,
    P_ROW TYPE I,
    P_COLOR(4) TYPE C .
    DATA:
    T_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
    FS_FIELDCAT LIKE LINE OF T_FIELDCAT,
    FS_LAYOUT TYPE SLIS_LAYOUT_ALV ,
    W_COLOR(4) ,
    W_ROW TYPE I,
    W_FIELDNAME(20),
    W_PROG TYPE SY-REPID.
    DATA:
    BEGIN OF T_SPFLI OCCURS 0,
    COLOR(4),
    CHECKBOX ,
    CELL TYPE SLIS_T_SPECIALCOL_ALV,
    CARRID TYPE SPFLI-CARRID,
    CONNID TYPE SPFLI-CONNID,
    CITYFROM TYPE SPFLI-CITYFROM,
    CITYTO TYPE SPFLI-CITYTO,
    DISTANCE TYPE SPFLI-DISTANCE,
    END OF T_SPFLI.
    DATA:
    FS_CELL LIKE LINE OF T_SPFLI-CELL.
    SELECT *
    FROM SPFLI
    INTO CORRESPONDING FIELDS OF TABLE T_SPFLI.
    W_COLOR = P_COLOR.
    T_SPFLI-COLOR = P_COLOR.
    IF P_COL IS INITIAL AND P_ROW GT 0.
    MODIFY T_SPFLI INDEX P_ROW TRANSPORTING COLOR.
    ENDIF.
    FS_FIELDCAT-FIELDNAME = 'CARRID'.
    FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
    FS_FIELDCAT-COL_POS = 1.
    FS_FIELDCAT-KEY = 'X'.
    FS_FIELDCAT-HOTSPOT = 'X'.
    APPEND FS_FIELDCAT TO T_FIELDCAT.
    CLEAR FS_FIELDCAT .
    FS_FIELDCAT-FIELDNAME = 'CONNID'.
    FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
    FS_FIELDCAT-COL_POS = 2.
    FS_FIELDCAT-KEY = 'X'.
    FS_FIELDCAT-HOTSPOT = 'X'.
    APPEND FS_FIELDCAT TO T_FIELDCAT.
    CLEAR FS_FIELDCAT .
    FS_FIELDCAT-FIELDNAME = 'DISTANCE'.
    FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
    FS_FIELDCAT-COL_POS = 3.
    FS_FIELDCAT-KEY = ' '.
    FS_FIELDCAT-EDIT = 'X'.
    APPEND FS_FIELDCAT TO T_FIELDCAT.
    CLEAR FS_FIELDCAT.
    FS_FIELDCAT-FIELDNAME = 'CITYFROM'.
    FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
    FS_FIELDCAT-COL_POS = 4.
    FS_FIELDCAT-KEY = ' '.
    APPEND FS_FIELDCAT TO T_FIELDCAT.
    LOOP AT T_FIELDCAT INTO FS_FIELDCAT.
    IF FS_FIELDCAT-COL_POS EQ P_COL.
    FS_FIELDCAT-EMPHASIZE = P_COLOR.
    W_FIELDNAME = FS_FIELDCAT-FIELDNAME.
    IF P_ROW IS INITIAL AND P_COL GT 0.
    MODIFY T_FIELDCAT FROM FS_FIELDCAT TRANSPORTING EMPHASIZE.
    ENDIF.
    ENDIF.
    ENDLOOP.
    FS_CELL-FIELDNAME = W_FIELDNAME .
    FS_CELL-COLOR-COL = 6.
    FS_CELL-NOKEYCOL = 'X'.
    APPEND FS_CELL TO T_SPFLI-CELL.
    IF P_ROW IS NOT INITIAL AND P_COL IS NOT INITIAL.
    MODIFY T_SPFLI INDEX P_ROW TRANSPORTING CELL.
    ENDIF.
    FS_LAYOUT-INFO_FIELDNAME = 'COLOR'.
    FS_LAYOUT-BOX_FIELDNAME = 'CHECKBOX'.
    FS_LAYOUT-COLTAB_FIELDNAME = 'CELL'.
    FS_LAYOUT-F2CODE = '&ETA'.
    W_PROG = SY-REPID.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = W_PROG
    IS_LAYOUT = FS_LAYOUT
    IT_FIELDCAT = T_FIELDCAT
    TABLES
    T_OUTTAB = T_SPFLI
    EXCEPTIONS
    PROGRAM_ERROR = 1
    OTHERS = 2

  • How to update a specific cell value in a CSV file.

    Hi
    I would like to know whether it is possible in openscript to update a cell value of the CSV file.
    For example if the test script requires to update the cell of 6th row and 8th column, then how to achieve through openscript API?
    Please kindly let me know.

    Hi,
    Hope this helps!
    Table table;
    String[] rowvalus;
    int targetRow=5,targetColumn=7;
    * Note: Rows and columns are 0-based index.
    table =utilities.loadCSV("C:\OracleATS\OFT\DataBank\Test.csv");
    rowvalus=table.getRows().get(targetRow).getAll();
    info("Before change :"+rowvalus[targetColumn]);
    rowvalus[targetColumn]="NewValue";
    utilities.saveCSV(table, "C:\OracleATS\OFT\DataBank\Test.csv", true);
    table =utilities.loadCSV("C:\OracleATS\OFT\DataBank\Test.csv");
    rowvalus=table.getRows().get(targetRow).getAll();
    info("After change :"+rowvalus[targetColumn]);
    Note:- Please first take the backup of your CSV file before using this code snippet
    Thanks
    -POPS

  • How to select a specific line in jQuery?

    Hi
    We are developing a list, where some salesorders are displayed.
    It is crated in BSP/Jquery.
    In my code I show a 10 lines - with a new salesorder on each line.
    When the user click on one of the lines (= one of the sales order), I want to
    1.take the salesorder (= get the selected value),
    2.get more details about the sales order (=need to make select into my backend)
    3.show the new details on a list (like a href="#details"...)
    My code looks like this:
    <div data-role="content">   
    <ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="a">   
    <li data-role="list-divider">Your Fav</li>  
    </ul>   
    </div>   
    <ul data-role="listview" data-inset="true" data-theme="d" data-dividertheme="c">   
    <%     loop at gt_fav_cust1 assigning <ls_fav_cust>.   
    select single name1 into <ls_fav_cust>-custname  
    from kna1 where kunnr = <ls_fav_cust>-kunnr.    %>  
    <li>
    <a href="#customer" data-transition="flip" data-rel="dialog">   
    <%= <ls_fav_cust>-kunnr %>   
    <%= <ls_fav_cust>-custname %>   
    </a>
    </li>  
    <%    endloop.    %>   
    </ul>
    Can anybody guide me in the right direction?

    Hi Frederico,
    The method setColumnSelection is meant to set whether your table supports column selection or not. It doesn't select the column. In order to select the column, you need to set the column attribute Selected to true. So I don't know if its an option for you but you can create a binding to all the columns you have in you bean, and then call the method A2012.setSelected(true), and then add a partial target to the table to re render it and show the selected column.
    Hope this helps

  • Specific cell event of Jtable

    Hi,
    I've created an view object by linking up 2 tables, and placed it on the screen by Jtable,
    select
    a.emp_name,
    a.dept_id,
    b.dept_name
    from
    employee a,
    department b;
    Is it possible to write an event that will reflesh and display the "dept_name" properly after the cell dept_id has been edited ?
    Thanks for helping !

    int height = table.getRowHeight();
    table.setRowHeight(35);in the docs dude

Maybe you are looking for