Tableview inputfield cell color

Hello,
I use a tableview with iterator.  In my RENDER_CELL_START I have one field as follows:
WHEN 'ZLIBE'.
      IF p_edit_mode IS NOT INITIAL.
        DATA: if_zlibe TYPE REF TO CL_HTMLB_INPUTFIELD.
        if_zlibe = CL_HTMLB_INPUTFIELD=>FACTORY( id = p_cell_id
maxlength = '50'
width = '400' ).
        if_zlibe->VALUE = m_row_ref->ZLIBE.
        p_style = 'celldesign:STCD_NEGATIVE'.
        p_replacement_bee = if_zlibe.
      ENDIF.
So, when I select a line in the tableview, this field can be changed... and I would like the color to be different when in editmode... thus I put
p_style = 'celldesign:STCD_NEGATIVE'.
.. however the color never changes.  Why doesn't this work?
Another question: the field just after this one (above), is:
WHEN 'ICON'.
      data image2 type ref to cl_htmlb_image.
      create object image2.
      image2->id = p_cell_id.
      IF p_edit_mode IS INITIAL.
        image2->src = cl_bsp_mimes=>sap_icon( `ICON_DISPLAY` ).
      ELSE.
        image2->onclick = 'OnSaveClick'.
        image2->src = cl_bsp_mimes=>sap_icon( `ICON_SYSTEM_SAVE` ).
      ENDIF.
      p_class = 'al am as'.
      p_replacement_bee = image2.
Basically a SAVE icon, when clicked, saves the data typed in the field (discusse above before this one).  So, I select a line, the like is highlighted (via standard tableView), I type a value in the editable field, click save, and yes the new value is written to my SAP table behind... BUT, the line stays selected (highlighted).  How can I, on this event (clicking this save button/icon) in addition to modifying my table with the new value, ALSO return to a normal tableView (no lines selected)????
Thanks,
Tim

Thanks Raja,
I implemented your answer to my second question, great.
As for the <b>cssClass</b> attribute, I am not sure how to use it... not alot of documentation onit.  I did find in class CL_SBSPEXT_ITERATOR in RENDER_CELL_START an example:
            col1_inputField->invalid = 'true'.
*             ao: new class 'background-color:#ffdfdf'
            col1_inputField->cssClass = `ao av`.
*             ao: new class 'background-color:#ffdfdf'
            P_CLASS = `ao`.
But I dont understand the line he puts (commented out also):
ao: new class 'background-color:#ffdfdf'
Doesn't make sense.
Maybe i need to make a <b>file.css</b>, then in set <b>cssClass = 'file.css'</b>???  Do you have any information on how to use this attribute?
Thanks,
Tim

Similar Messages

  • Report Generation broken after deployment - Excel Set Cell Color and Border.vi

    Upon deployment, the Excel Set Cell Color and Border.vi became broken.  After installing LV2010 SP1 to view the VIs in the deployment, I noticed that in the second case structure where the code draws the border using the BorderAround invoke node, there is an extra variant input parameter named 'Parameters'.  Upon right-clicking, an option to 'Relink Invoke Node' appeared and after selecting this, the extra input disappeared and the VI was no longer broken.
    Why does "Relink Invoke Node" appear?  How do I create a deployment with this issue?  Has anybody else experienced this?  Why is the TestStand deployment so buggy?  

    Hi Ching-Hwa,
    I have set up a test deployment here where I am deploying a workspace that contains a sequence file.  This sequence file has a LabVIEW Action Step calling a VI that opens a new Excel file and simply calls the Excel Set Cell Color and Border VI.  After deploying this, both the VI and my test sequence ran on the deployment machine without error.  Therefore, I do have some more questions to more accurately reproduce what you are seeing.
    First, what operating systems are you developing on and deploying to?  Also, what license do you have for TestStand on the machine you are deploying to?  If you have a development version, can you manually take the sequence file and VI to this machine and run it?  I know you now have LabVIEW 2010 SP1 on your development machine, but if you have the development version of TestStand as well, it would be interesting to see if you copy the files over if you still see this behavior.  Are you including the TestStand Engine in the deployment?
    Can you open a blank VI on the deployment machine and add the Excel Set Cell Color and Border VI?  It would also be interesting to see if this is not a product of the deployment, but rather an issue with something on the deployment machine itself.  What version of the Report Generation Toolkit do you have on each machine?  Also, what versions of Excel are you using on the development and deployment machine?  Again, it would be helpful for me to know exactly what versions you have installed on both the development and deployment machines so that I can reproduce this as accurately as possible.
    One last thing to try, too, would be to try deploying the VI by itself just to see if it also has the same behavior.  Do you have the Application Builder in LabVIEW?  If so, could you also try building an executable from the VI, create an installer, and deploy this to the deployment machine?  
    In regards to the "freezing" of code by removing the block diagrams, I do not believe this will be a proper work around in this case.  While this removes the block diagram from actually being deployed along with the VI and restricts users from editing the code on the deployment machine, if something is getting changed in the compiled code upon deployment, this will not stop this from happening.  This option is available more as a memory option to lower the size of the deployment as well as prohibit any users on the development machine from editing the block diagram themselves.    
    Thanks, Ching-Hwa!  I look forward to your response so that I can continue trying to reproduce this issue.  Have a great day! 
    Taylor G.
    Product Support Engineer
    National Instruments
    www.ni.com/support

  • How do i change the cell color of each cell in datagrid dynamically

    I have a  datagrid filled in with data..My job is to change the cell color of a particular cell in the datagrid when the user clicks that cell..Please help me asap..I have to change the color of each cell dynamically..

    Pls find the solution of ur problem.Let me know if you have any issue.
    MainApplicaion.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical">
        <mx:Script>
            <![CDATA[
                import mx.collections.ArrayCollection;
                import mx.events.ListEvent;
                [Bindable]
                  private var listDataArrayCollection:ArrayCollection=
                  new ArrayCollection([
                    {seq:'1',color:'0xFF0000', names:'John'},
                    {seq:'2',color:'0x00FF00', names:'Alex'},
                    {seq:'3',color:'0x0000FF', names:'Peter'},
                    {seq:'4',color:'0xFF0000', names:'Sam'},
                    {seq:'5',color:'0x00FF00', names:'Alis'},
                    {seq:'6',color:'0x0000FF', names:'Robin'},
                    {seq:'7',color:'0xFF0000', names:'Mark'},
                    {seq:'8',color:'0x00FF00', names:'Steave'},
                    {seq:'9',color:'0x0000FF', names:'Fill'},
                    {seq:'10',color:'0xFF0000', names:'Abraham'},
                    {seq:'11',color:'0x00FF00', names:'Hennery'},
                    {seq:'12',color:'0x0000FF', names:'Luis'},
                    {seq:'13',color:'0xFF0000', names:'Herry'},
                    {seq:'14',color:'0x00FF00', names:'Markus'},
                    {seq:'15',color:'0x0000FF', names:'Flip'},
                    {seq:'16',color:'0xFF0000', names:'John_1'},
                    {seq:'17',color:'0x00FF00', names:'Alex_1'},
                    {seq:'18',color:'0x0000FF', names:'Peter_1'},
                    {seq:'19',color:'0xFF0000', names:'Sam_1'},
                    {seq:'20',color:'0x00FF00', names:'Alis_1'},
                    {seq:'21',color:'0x0000FF', names:'Robin_1'},
                    {seq:'22',color:'0xFF0000', names:'Mark_1'},
                    {seq:'23',color:'0x00FF00', names:'Steave_1'},
                    {seq:'24',color:'0x0000FF', names:'Fill_1'},
                    {seq:'25',color:'0xFF0000', names:'Abraham_1'},
                    {seq:'26',color:'0x00FF00', names:'Hennery_1'},
                    {seq:'27',color:'0x0000FF', names:'Luis_1'},
                    {seq:'28',color:'0xFF0000', names:'Herry_1'},
                    {seq:'29',color:'0x00FF00', names:'Markus_1'},
                    {seq:'30',color:'0x0000FF', names:'Flip_2'}
                private function onItemClick(event : ListEvent):void
                    var dataObj : Object = event.itemRenderer.data;
                    dataObj.color = "0xFF00FF";
                    event.itemRenderer.data = dataObj;
            ]]>
        </mx:Script>
        <mx:VBox width="300" height="100%"
            horizontalAlign="center"
            verticalAlign="middle">
            <mx:DataGrid id="listComponent" width="50%"
                     height="100%"
                     borderStyle="none"
                     dataProvider="{listDataArrayCollection}"
                     itemClick="onItemClick(event)">
                     <mx:columns>
                     <mx:DataGridColumn width="100" dataField="{data.seq}" headerText="Seq" itemRenderer="SeqItemRenderer" />
                     <mx:DataGridColumn width="100" dataField="{data.names}" headerText="Name" itemRenderer="NameItemRenderer"/>
                     </mx:columns>
                     </mx:DataGrid>
        </mx:VBox>
    </mx:Application
    NameItemRenderer.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml"
        width="100" height="30" horizontalGap="5" horizontalScrollPolicy="off">
    <mx:Script>
        <![CDATA[
            override public function set data(value:Object):void
                 super.data = value;
        ]]>
    </mx:Script>
            <mx:TextInput width="75" height="30"
                 text="{data.names}"
                 editable="false" backgroundColor="{data.color}"/>
        </mx:HBox>
    SeqItemRenderer.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml"
        width="100" height="30" horizontalGap="5" horizontalScrollPolicy="off">
    <mx:Script>
        <![CDATA[
            override public function set data(value:Object):void
                 super.data = value;
        ]]>
    </mx:Script>
            <mx:TextInput width="75" height="30"
                 text="{data.seq}"
                 editable="false" backgroundColor="{data.color}"/>
        </mx:HBox>
    with Regards,
    Shardul Singh Bartwal

  • Setting cell color in ALV

    Hi All
    I would be greatful if someone could please help...
    I am still attempting to get cells painted within a WDA ALV grid display.
    I have tried to use the method stated in the WDA sap press book - but this method is for use with TABLE element and I am using a ViewContainerUIElement for my table. There are mentions of wonderful ways to color cells in a list display - but I cannot understand how this can be achieved. I currently have this working appart from the numeric numbers of the design being set into the relavant column cell.
    If anyone could help that would be great...
    Please see: http://picasaweb.google.co.uk/dave.alexander69/Pictures#5244800978549492338
       LOOP AT lt_zdata INTO ls_zdata.
            lv_index = sy-tabix.
    *       set column values
    *       loop at row data and set colour attributes of individual cells
            LOOP AT lt_columns ASSIGNING <fs_column>.
              lr_col_header = <fs_column>-r_column->get_header( ).
              lr_col_header->set_ddic_binding_field( ).
              CREATE OBJECT lr_input_field EXPORTING value_fieldname = <fs_column>-id.
              lr_column = lr_column_settings->get_column( <fs_column>-id ).
    *         for the date columns only...
              IF <fs_column>-id(4) = 'CELL'.
    *           get and set column dates from select option user input
                READ TABLE lt_dates INTO ls_dates INDEX 1.
                IF lt_dates IS INITIAL.
                  lr_col_header->set_text( 'Date' ).
                ELSE.
                  ls_dates-low = ls_dates-low + lv_incr_date.
                  MOVE ls_dates-low+2(2) TO lv_for_col_date+6(2).   "Year
                  MOVE ls_dates-low+4(2) TO lv_for_col_date+3(2).   "Month
                  MOVE ls_dates-low+6(2) TO lv_for_col_date(2).     "Day
                  MOVE lv_for_col_date   TO lv_col_date.
                  lr_col_header->set_text( lv_col_date ).
                  lv_incr_date = lv_incr_date + 7.
                ENDIF.
                LOOP AT lt_orgdata_dates INTO ls_orgdata_dates
                  WHERE crew = ls_zdata-crew
                    AND position = ls_zdata-position
                    AND name = ls_zdata-person
                    AND trip_arr >= ls_dates-low
                    AND trip_dep <= ls_dates-low.
    *             column heading settings
                  lr_field = lr_table->if_salv_wd_field_settings~get_field( <fs_column>-id ).
                  lr_field->if_salv_wd_sort~set_sort_allowed( abap_false ).
    * trying to set cell variants ?@#??!!???
    *              lr_cv = lr_column->set_key( ls_zdata-variance ).
    *              lr_cv->set_editor( lr_input_field ).
    *              lr_cv->set_cell_design( value = '01').
    *              lr_column->add_cell_variant( lr_cv ).
    * current method of seeting the cell colors... (but puts value in cell!)
                  FIELD-SYMBOLS: <fs> TYPE data.
                  lr_column->set_cell_design_fieldname( value = <fs_column>-id ).
                  ASSIGN COMPONENT <fs_column>-id OF STRUCTURE ls_zdata TO <fs>.
                  WRITE: CL_WD_TABLE_COLUMN=>e_cell_design-one TO <fs>.
                  MODIFY lt_zdata FROM ls_zdata. " INDEX lv_index.
                ENDLOOP.
              ENDIF.
    Kind Regards
    Dave Alexander

    Hi check this code to set cell colors for ALV grid.
    Take a context attribute with type WDUI_TABLE_CELL_DESIGN.
    Here i am populating colors based on some condition.Check the loop of the internal table.
    method get_flight_details .
    data:node_flights type ref to if_wd_context_node,
         it_flights type sflight_tab1,
         ls_flights type sflight,
         it_final type   if_componentcontroller=>elements_flights,
         ls_final type   if_componentcontroller=>element_flights.
        select * from sflight into table it_flights
    up to 100 rows.
        node_flights = wd_context->get_child_node( 'FLIGHTS' ).
        loop at it_flights into ls_flights.
           move-corresponding ls_flights to ls_final.
           if ls_final-price = '185.00'.
              ls_final-readonly = abap_true.
              ls_final-celldesign =
    cl_wd_table_column=>e_cell_design-badvalue_light.
           else.
              ls_final-readonly = ' '.
              ls_final-celldesign =
    cl_wd_table_column=>e_cell_design-goodvalue_light.
           endif.
           append ls_final to it_final.
        endloop.
        node_flights->bind_table(
            new_items            = it_final
            set_initial_elements = abap_true
    *        INDEX                = INDEX
    data: l_ref_cmp_usage type ref to if_wd_component_usage.
    l_ref_cmp_usage =   wd_this->wd_cpuse_alv( ).
    if l_ref_cmp_usage->has_active_component( ) is initial.
       l_ref_cmp_usage->create_component( ).
    endif.
    data: l_ref_interfacecontroller type ref to iwci_salv_wd_table .
    l_ref_interfacecontroller =   wd_this->wd_cpifc_alv( ).
       data:
         l_value type ref to cl_salv_wd_config_table.
       l_value = l_ref_interfacecontroller->get_model(
    * Make Price column editable
    data:l_column type ref to cl_salv_wd_column,
          l_column1 type ref to cl_salv_wd_column,
          lr_input type ref to cl_salv_wd_uie_input_field,
          l_input1 type ref to cl_salv_wd_uie_input_field.
    l_column = l_value->if_salv_wd_column_settings~get_column( 'PRICE' ).
    create object lr_input
      exporting
        value_fieldname = 'PRICE'
    l_column->set_cell_editor( value = lr_input ).
    * to make some cells non editable
    lr_input->set_read_only_fieldname( value = 'READONLY' ).
    l_value->if_salv_wd_column_settings~delete_column( id = 'READONLY'   )
    *Set the table Editable
    l_value->if_salv_wd_table_settings~set_read_only( value = abap_false ).
    *Give colors to cells
    l_column1 = l_value->if_salv_wd_column_settings~get_column( 'CARRID' ).
    l_column1->set_cell_design_fieldname( value = 'CELLDESIGN'  ).
    l_value->if_salv_wd_column_settings~delete_column( id = 'CELLDESIGN' )
    endmethod.
    Thanks
    Suman

  • Mouse over to change cell color

    Can anyone point me to a really good tutorial for doing mouse
    over also
    changes the cell color?.
    Ive tried a few and spent hours on it and just cannot get it
    to work
    correctly.
    Here is my basic starting .css which i start off with each
    time.
    .tnav {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #FFFFFF;
    .tnav a:link {
    color: #FFFFFF;
    font-size: 12px;
    text-decoration: none;
    .tnav a:visited {
    color: #FFFFFF;
    text-decoration: none;
    .tnav a:hover {
    color: #FFFFFF;
    text-decoration: underline;
    .tnav a:active {
    color: #FFFFFF;

    On Thu, 8 Mar 2007 14:42:35 -0000, "Mike"
    <[email protected]> wrote:
    >Can anyone point me to a really good tutorial for doing
    mouse over also
    >changes the cell color?.
    Change your CSS to this:
    .tnav {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #FFFFFF;
    .tnav a {
    color: #FFFFFF;
    display: block;
    text-decoration: none;
    .tnav a:hover {
    color: #FFFFFF;
    text-decoration: underline;
    Add a conditional comment to the <head> of the document
    to correct for
    an IE browser bug:
    <!--[if ie]>
    <style type="text/css">
    .tnav a {
    height: 1%;
    </style>
    <![endif]-->
    Gary

  • SSRS Reporting : Fill Cell Color according to the Location of the Cell in the Matrix

    Hello,
    I am trying to achieve below result in the SSRS but facing issues with Cell color Fill Expression when Detail value is NULL.
    If you look at the image, it should show exact same colors of the cell irrespective of the values.
    But in my case it is not showing color for NULL value cells.
    Below is the expression which I have put in the Fill Expression window.
    SWITCH(
    Fields!Columns.Value = "Col1" And Fields!Rows.Value = "Row1","Yellow",
    Fields!Columns.Value = "Col1" And Fields!Rows.Value = "Row2","Green",
    Fields!Columns.Value = "Col1" And Fields!Rows.Value = "Row3","Green",
    Fields!Columns.Value = "Col1" And Fields!Rows.Value = "Row4","Green",
    Fields!Columns.Value = "Col2" And Fields!Rows.Value = "Row1","Red",
    Fields!Columns.Value = "Col2" And Fields!Rows.Value = "Row2","Yellow",
    Fields!Columns.Value = "Col2" And Fields!Rows.Value = "Row3","Yellow",
    Fields!Columns.Value = "Col2" And Fields!Rows.Value = "Row4","Green",
    Fields!Columns.Value = "Col3" And Fields!Rows.Value = "Row1","Red",
    Fields!Columns.Value = "Col3" And Fields!Rows.Value = "Row2","Red",
    Fields!Columns.Value = "Col3" And Fields!Rows.Value = "Row3","Yellow",
    Fields!Columns.Value = "Col3" And Fields!Rows.Value = "Row4","Green"
    Please suggest me to get the colors for the NULL value cells.
    I tried with IsNothing() but then it is doing the same color of all NULL cells. I want them exactly same in the figure.
    Thank you,
    Mittal.

    Hi Mittal,
    Based on your dataset table, the matrix should displays as below. Are you manually insert Row1 row and Col3 column in the matrix?
    If that is true, the Fill cell color should be displayed as the picture above. Because there are no values for Rows=Row1 and Columns= Col1, Rows=Row1 and Columns= Col2… the expression for those cells has no effect. To achieve your requirement, we can manually
    insert those values in the dataset query like below:
    SELECT Columns, Rows, Value FROM table
    UNION all
    select 'Col1' AS Columns, 'Row1' AS Rows, NULL AS Value
    UNION all
    select 'Col1' AS Columns, 'Row3' AS Rows, NULL AS Value
    UNION all
    select 'Col2' AS Columns, 'Row1' AS Rows, NULL AS Value
    UNION all
    select 'Col2' AS Columns, 'Row4' AS Rows, NULL AS Value
    UNION all
    select 'Col3' AS Columns, 'Row1' AS Rows, NULL AS Value
    UNION all
    select 'Col3' AS Columns, 'Row2' AS Rows, NULL AS Value
    UNION all
    select 'Col3' AS Columns, 'Row3' AS Rows, NULL AS Value
    UNION all
    select 'Col3' AS Columns, 'Row4' AS Rows, NULL AS Value
    Then directly add those three field with the fill cell color expression to matrix, the matrix displays:
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Excel Set Cell Color and Border.viのbackground color 設定について

    お世話になっております。
    Microsoft オフィス用レポート生成ツールキットを使って
    LabVIEWで収集したデータをExcelファイルで出力しようと考えています。
    そこで質問が有ります。
    題名のようにExcel Set Cell Color and Border.viのbackground color 設定についてです。
    デフォルト(未配線)では白に設定されていますが、”色なし”に設定するにはどうしたら良いのでしょうか?
    又、罫線色等を指定する数値設定に関しては、何処を調べたら良いのでしょうか?
    ご教授の程、宜しくお願い致します。

    _YN 様
    平素よりNI製品をご利用頂きまして誠にありがとうございます。
    日本ナショナルインスツルメンツ技術部の湧川と申します。
    ご質問にお答え致します。
    色なしにしたいとの事ですが、こちらでExcel Set Cell Color and Border.viを使用して簡単なVIを実行させてみましたが色なしに設定することはできませんでした。
    そこで質問したいのですが色なしにする理由というのはバックグラウンドが白のままだとセルの枠が見えなくなるからでしょうか。
    もしそうであれば設定により枠をつけることができますのでそちらの方を試して頂けたらと思います。
    方法としましては同じExcel Set Cell Color and Border.viを使い設定します。
    アイコンの上部にピンク色のピンが2つあるかと思いますがそちらからセル内側の線、外側の線を設定できます。
    添付した画像を参照して下さい。
    画像のように設定しますとセルに黒色の枠ができると思います。
    数値設定などに関しても質問されていますが、そちらはヘルプがありますのでそちらを参照頂けると詳しい情報がわかるかと思います。
    LabVIEWでVIを開いている時に ctrl + H を押しますと小さいウィンドウ「詳細ヘルプ」が立ち上がります、その状態でマウスのポインタをアイコンに重ねて頂きますと詳細ヘルプにアイコンの説明が記述されます。
    ウィンドウズ内のリンクからオンラインヘルプを参照することもできます。
    上記内容をご確認いただきまして、何かS_YN様の意図と違う点などありましたらご連絡下さい。
    宜しくお願い致します。
    日本ナショナルインスツルメンツ株式会社
    技術部
    湧川 朝満
    添付:
    Excle Set Color Sample.JPG ‏58 KB

  • Cell Coloring using DAX in SSAS Tabular Model

    HI All, 
    I need to implement  background and foreground cell coloring in SSAS Tabular Model using DAX or any other feasible solution similar to what Cell Properties does with MDX which is supported by SSAS Cubes. 
    Request the gurus to help me with this problem.
    Thanks 
    ET

    Hi Et,
    As Marco said, this feature is not supported in current version. If you have any concern about this behavior, you can submit a feedback at
    http://connect.microsoft.com/SQLServer/Feedback and hope it is resolved in the next release of service pack or product. Your feedback enables Microsoft to make software and services the best that
    they can be, Microsoft might consider to add this feature in the following release after official confirmation.
    Thank you for your understanding.
    Regards,
    Charlie Liao
    TechNet Community Support

  • Problem when setting JTable cell color.

    hello,
    when I setting color for particular table cell, it sets.
    but, when I click another row (another cell) , the color of the previous cell disabled and it visible only when I click that cells row.
    how can I permanatly set the color for the rows depends on input data.
    for example,
    if a device is connected, I want to give the cell color GREEN.
    if device is not connected , i want to give the color as RED.
    thank you.

    but, when I click another row (another cell) , the color of the previous cell disabled and it visible only when I click that cells row.It appears you applied color to cell editor.
    tableObj.getComponentAt(x,y).setForeground(Color.red);
    tableObj.getComponentAt(x,y).setBackground(Color.red); or could be solved properl if you post the code

  • Set Cell Color without using DefaultTableCellRenderer

    Hi,
    Is there any possible to set the JTable cell color without using DefaultTableCellRenderer ?. For ex, I have one JTable that having 9 rows and 9 columns. I have to set the cell color in 2nd row & 3rd column.
    Please anyone give me guidance to solve this.
    Thanks & Regards
    S Senthilkumar

    Fine.. Please try to understand my points.
    Because in my application I have JTable that having 10 columns and rows dynamically will come based on the value fetch from arraylist. If I use DefaultTableCellRenderer, for each record its calling CustomTableCellRenderer(). For example arraylist return 10 rows means its looping 100 times(10 rows * 10 columns).
    CustomTableCellRenderrer.java
    ArrayList dataLiveMarket = (ArrayList) new CheckUser().getLiveMarketDetails(unval);
    CustomTableModel modelLiveMarket = new CustomTableModel(dataLiveMarket);
    JTable tableOne = new JTable(modelLiveMarket);
    tableOne.setDefaultRenderer(Object.class, new CustomTableCellRenderer());
    CustomTableCellRenderrer.java
    package com.fxtrading.dao;
    import java.awt.Color;
    import java.awt.Component;
    import javax.swing.JTable;
    import javax.swing.SwingConstants;
    import javax.swing.table.DefaultTableCellRenderer;
    import javax.swing.table.TableModel;
    * @author user
    public class CustomTableCellRenderer extends DefaultTableCellRenderer {
        //private TableModel bidLastPrice;
        //int k;
        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus,
                int row, int column) {
            Component component =
                    super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
            if (column == 0 || column == 1|| column == 2) {
                setHorizontalAlignment(SwingConstants.LEFT);
            } else if(column == 3 || column == 4 || column == 5 || column == 6 || column == 7 || column == 8){
                setHorizontalAlignment(SwingConstants.RIGHT);
            }else if(column == 9){
                setHorizontalAlignment(SwingConstants.CENTER);
            // Change cell Color - Started
            bidLastPrice = table.getModel();
            int bidLastRowCount =(int)table.getRowCount();
            for(k=0; k<bidLastRowCount; k++) {
                String bidPrice = (String)bidLastPrice.getValueAt(k,4);
                String lastPrice = (String)bidLastPrice.getValueAt(k,8);
                bidPrice = bidPrice.replace(",","").replace("$","");
                lastPrice = lastPrice.replace(",","").replace("$","");
                if(Double.parseDouble(bidPrice)<Double.parseDouble(lastPrice)){
                    if(row == k && column == 4){
                        component.setBackground(Color.RED);                   
                    }else{
                        component.setBackground(Color.WHITE);
                    System.out.println("Row Count -->"+k+" Less ----> Bid Price----> "+Double.parseDouble(bidPrice)+" : Last Price----> "+Double.parseDouble(lastPrice));
                }else{
                    if(row == k && column == 4){                  
                        component.setBackground(Color.GREEN);
                    }else{
                        component.setBackground(Color.WHITE);
                    System.out.println("Row Count -->"+k+" More ----> Bid Price----> "+Double.parseDouble(bidPrice)+" : Last Price----> "+Double.parseDouble(lastPrice));
            // Change cell Color - End
            return component;
    }Thanks & Regards,
    S Senthilkumar

  • Cell color

    Hello,
    I am using the ALV OO for the display.
    I need to color a particular cell.
    How can i do it ?
    CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
      EXPORTING
        I_STRUCTURE_NAME              = 'gt_STRUCT'
        I_SAVE                        = X_SAVE
        I_DEFAULT                     = LV_DEF
       IS_LAYOUT                     = LS_LAYOUT
      CHANGING
        IT_OUTTAB                     = GT_BPSTAB[]
        IT_FIELDCATALOG               = GT_FIELDCATALOG[]
      EXCEPTIONS
        INVALID_PARAMETER_COMBINATION = 1
        PROGRAM_ERROR                 = 2
        TOO_MANY_LINES                = 3
        OTHERS                        = 4

    Hello,
    Check this example,it may help u.
    report z_example.
    tables : mara.
    Type
    types : begin of ty_mara,
              matnr         like mara-matnr,
              matkl         like mara-matkl,
              counter(4)    type n,
              free_text(15) type c,
              color_line(4) type c,           " Line color
              color_cell    type lvc_t_scol,  " Cell color
    end of ty_mara.
    Structures
    data  : wa_mara     type ty_mara,
            wa_fieldcat type lvc_s_fcat,
            is_layout   type lvc_s_layo,
            wa_color    type lvc_s_scol.
    Internal table
    data : it_mara     type standard table of ty_mara,
           it_fieldcat type standard table of lvc_s_fcat,
           it_color    type table          of lvc_s_scol.
    Variables
    data : okcode like sy-ucomm,
           w_alv_grid          type ref to cl_gui_alv_grid,
           w_docking_container type ref to cl_gui_docking_container.
    parameters : p_column as checkbox,
                 p_line   as checkbox,
                 p_cell   as checkbox.
    at selection-screen output.
      perform get_data.
      perform fill_catalog.
      if w_docking_container is initial.
        perform create_objects.
      endif.
    *&      Form  create_objects
    form create_objects.
      create object w_docking_container
        exporting
          ratio                       = 60
        exceptions
          cntl_error                  = 1
          cntl_system_error           = 2
          create_error                = 3
          lifetime_error              = 4
          lifetime_dynpro_dynpro_link = 5
          others                      = 6.
      create object w_alv_grid
        exporting
          i_parent          = w_docking_container.
    Field that identify color line in internal table
      move 'COLOR_LINE' to is_layout-info_fname.
    Field that identify cell color in inetrnal table
      move 'COLOR_CELL' to is_layout-ctab_fname.
      call method w_alv_grid->set_table_for_first_display
        exporting
          is_layout                     = is_layout
        changing
          it_outtab                     = it_mara
          it_fieldcatalog               = it_fieldcat
        exceptions
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          others                        = 4.
    endform.
    *&      Form  get_data
    form get_data.
      select * from mara up to 5 rows.
        clear : wa_mara-color_line, wa_mara-color_cell.
        move-corresponding mara to wa_mara.
        add 1                   to wa_mara-counter.
        move 'Blabla'           to wa_mara-free_text.
        if wa_mara-counter = '0002'
        and p_line = 'X'.
    Color line
          move 'C410' to wa_mara-color_line.
        elseif wa_mara-counter = '0004'
        and p_cell = 'X'.
    Color cell
          move 'FREE_TEXT' to wa_color-fname.
          move '6'         to wa_color-color-col.
          move '1'         to wa_color-color-int.
          move '1'         to wa_color-color-inv.
          append wa_color to it_color.
          wa_mara-color_cell[] = it_color[].
        endif.
        append wa_mara to it_mara.
      endselect.
    endform.
    *&      Form  fill_catalog
    form fill_catalog.
    Colour code :                                                 *
    Colour is a 4-char field where :                              *
                 - 1st char = C (color property)                  *
                 - 2nd char = color code (from 0 to 7)            *
                                     0 = background color         *
                                     1 = blue                     *
                                     2 = gray                     *
                                     3 = yellow                   *
                                     4 = blue/gray                *
                                     5 = green                    *
                                     6 = red                      *
                                     7 = orange                   *
                 - 3rd char = intensified (0=off, 1=on)           *
                 - 4th char = inverse display (0=off, 1=on)       *
    Colour overwriting priority :                                 *
      1. Line                                                     *
      2. Cell                                                     *
      3. Column                                                   *
      data : w_position type i value '1'.
      clear wa_fieldcat.
      move w_position to wa_fieldcat-col_pos.
      move 'MATNR'    to wa_fieldcat-fieldname.
      move 'MARA'     to wa_fieldcat-ref_table.
      move 'MATNR'    to wa_fieldcat-ref_field.
      append wa_fieldcat to it_fieldcat.
      add 1 to w_position.
      clear wa_fieldcat.
      move w_position to wa_fieldcat-col_pos.
      move 'MATKL'    to wa_fieldcat-fieldname.
      move 'MARA'     to wa_fieldcat-ref_table.
      move 'MATKL'    to wa_fieldcat-ref_field.
    Color column
      if p_column = 'X'.
        move 'C610'     to wa_fieldcat-emphasize.
      endif.
      append wa_fieldcat to it_fieldcat.
      add 1 to w_position.
      clear wa_fieldcat.
      move w_position to wa_fieldcat-col_pos.
      move 'COUNTER'  to wa_fieldcat-fieldname.
      move 'N'        to wa_fieldcat-inttype.
      move '4'        to wa_fieldcat-intlen.
      move 'Counter'  to wa_fieldcat-coltext.
      append wa_fieldcat to it_fieldcat.
      add 1 to w_position.
      clear wa_fieldcat.
      move w_position  to wa_fieldcat-col_pos.
      move 'FREE_TEXT' to wa_fieldcat-fieldname.
      move 'C'         to wa_fieldcat-inttype.
      move '20'        to wa_fieldcat-intlen.
      move 'Text'      to wa_fieldcat-coltext.
      append wa_fieldcat to it_fieldcat.
    endform.
    Regards

  • DataGrid: Modify Foreground Cell Color A Based on Content Of Cell B - Is it possible?

    Hi there!
    In this forum we can found two nice thread about datagrid format:
    Modifying background color of datagrid based on data in grid
    Change the RowBackground Color of Datagrid
    You can also find a great example here:
    LightSwitch control colors of DataGrid rows and other UI elements
    All the examples are about Format Cell A based on its content. A need an example where Cell A are formated based on Cell B content.
    Is it possible do it?
    Best regards,
    Ciro

    Hi!
    Have you any success in implementing row/cell coloring?
    Maybe I'll sound little pessimistic, but I just lost 3 days getting something similar to work.. LS is just not up to task.. Now I'm not surprised that it went on the road it went (abandoned).. While the idea is great, everything else is just -> meh..
    (and i'm here all the way from beta 1)..
    I have simple "is_active" computed property (but I feel it's the same with properties from related tables) and need to color rows accordingly: green - active, red - inactive.. It works inconsistently.. If you have some complex screen you need to
    find hook points where you could inject methods to tell datagrid to refresh layout (like "datagrid.OnApplyTemplate"), or just "collection.refresh()".. On every screen I used it there is some "catch".. I've
    tried almost everything I could find on net, Dave's example(s), Otis example, some already aged similar SL posts..  tried to connect tables in various combination
    like 0..1 -> 1.. I have even converted my tables logic to RIA services where main table does not have computed properties but whole table is returned with "real" properties from RIA service (so "is_active" is computed before arriving
    to client).. Still same stupidities, inconsistency, "loading_row" not being fired, not to mention troubles in plumbing all together between RIA tables and "real" tables...
    Something so "simple" shouldn't be so complicated to achieve.. If anyone have (kind of) solution I'd like to hear/read it cause right now this "LS thing" have big chance to fly trough my window together with my pc..
    Kivito
    Nobody expects the Spanish Inquisition! (M.P.F.C.)

  • Sharepoint 2013 Library cell color

    Hi,
    How can I change a cell color of a field to Green/Red but my field name in projectstatus.
    http://techtrainingnotes.blogspot.in/2008/11/sharepoint-color-coding-sharepoint.html
    How can I use this for 2013 library cell.
    rgds/-

    here is similar for calendar( true for 2013)
    http://davidlozzi.com/2012/01/26/color-code-your-sharepoint-calendar/
    or http://www.xelleration.com/Blogs/Lists/Posts/Post.aspx?ID=8
    you can use the java script to get this:
    http://www.learningsharepoint.com/2013/04/04/color-code-list-items-with-javascript-using-js-link-in-sharepoint-2013/
    http://davecoleman146.com/2013/07/08/colour-coding-a-sharepoint-2013-list-with-jquery/
    Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog

  • Cell Color after uploading a graphics

    Hi,
    I'm required to upload graphics in the smartforms I'm developing.  The Cell in my template has to be gray but when I'm uploading the graphics the shading & bording of the graphic is white so the cell i'm getting is gray with white. How can I get rid of the white portion in the cell.

    I have tried this.. and it is working very well on my system..
    I have kept the cell color as Gray and I have uploaded the graphic (That is having white color border) within the cell ... All are perfect...
    Try this in your Graphic window -> General Attributes -> Tech attributes -> Resolution -- > Keep it at 100 or 150 DPI
    Hope you get something..
    Best luck..
    Regs,
    Lokesh

  • Alv cell color with FM

    hi ,
    can one send me program for alv cell color with help of function modules
    kiran

    Hi Kiran .
    <b>1.Cell Color.</b>
    While Building Fieldcatalog ,there is one field called
    EMPHASIZE.You have to set like this .
    i_field-emphasize = 'C26'.
    <b>2.ROW COLOR.</b>
    Have a look at this example .
    <b>a</b>.Define one variable COLOR in ur main ITAB.
    <b>b</b>.Fill it .
    <b>c</b>.Pass this info.
      w_layout-info_fieldname = 'COLOR'.
    <b>d</b>. display it .
    *& Report  ZGRID_COLOR                                                 *
    REPORT  zgrid_color                             .
    TYPE-POOLS slis.
    DATA: BEGIN OF i_pa0001 OCCURS 0,
    <b>        color(3) TYPE c,</b>
            pernr TYPE pa0001-pernr,
            subty TYPE pa0001-subty,
          END OF i_pa0001.
    DATA :i_field TYPE slis_t_fieldcat_alv,
          w_field LIKE LINE OF i_field,
          w_layout TYPE slis_layout_alv.
    START-OF-SELECTION .
      PERFORM get_data.
      PERFORM fieldcat.
      PERFORM layout_build.
      PERFORM dispaly .
    *&      Form  fieldcat
    FORM fieldcat .
      CLEAR :w_field,i_field[].
      w_field-fieldname = 'PERNR'.
      w_field-tabname   = 'I_PA0001'.
      w_field-seltext_m = 'PERNR'.
      APPEND w_field TO i_field.
      CLEAR w_field.
      w_field-fieldname = 'SUBTY'.
      w_field-tabname   = 'I_PA0001'.
      w_field-seltext_m = 'SUBTY'.
      APPEND w_field TO i_field.
      CLEAR w_field.
    ENDFORM.                    " fieldcat
    *&      Form  dispaly
    FORM dispaly .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       i_callback_program                = 'ZGRID_COLOR'
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
    <b>   is_layout                         = w_layout</b>
       it_fieldcat                       = i_field
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
      IT_EVENTS                         =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      I_HTML_HEIGHT_TOP                 =
      I_HTML_HEIGHT_END                 =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = i_pa0001
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " dispaly
    *&      Form  get_data
    FORM get_data .
      SELECT pernr subty
      FROM pa0001
      INTO CORRESPONDING FIELDS OF TABLE i_pa0001
      UP TO 10 ROWS.
    LOOP AT i_pa0001.
        IF sy-tabix GT 5.
      <b>    i_pa0001-color = 'C51'.</b>
          MODIFY i_pa0001 INDEX sy-tabix.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " get_data
    *&      Form  layout_build
    FORM layout_build .
    <b>  w_layout-info_fieldname = 'COLOR'.</b>
    ENDFORM.                    " layout_build
    I hope it helps u .
    <b>Thanks,
    Venkat.O</b>

Maybe you are looking for

  • XML parsing problem

    Hi, my problem is : In my Application i want to parse an XML file with DOM parser. The problem is that in my Project "MyProject -> Project Properties -> Libraries and Classpath" I have included some 15 libraries which are useful for my Application: A

  • How to create a Bool Option for Full Screen and Page Item in Mucow?

    Hi Guys! I was looking to create a bool option in Mucow widget options which toggles between Full Screen and a Normal Page Item . Example: Qooqee's Google Map Widget Need some help. Thanks in Advance

  • OS Mountain Lion won't install on disk (Linux partitioned)

    I just downloaded Mountain Snow and apparently It doesn't recognize the hard drive in which to install it because it doesn't look at the partition table but just at the hard drives. I have got a mac with a triple boot (Mac OS on sda1, grub on sda 2,

  • Apply "WHERE CONDITION" in "MASTER/DETAIL FORM" in "ORACLE APEX

    Hi to all respected Gurus of this community. I have a problem and I hope that there must be solution in this community and I am not aware of that till now. I have a master/detail form in Oracle Application Express. Now, I want to apply a where condit

  • LV 7.1.1 PDA modules & excel issues

    Hey everybody, i've attached a VI i wrote, all it does is add a number and stores it into an array then i write to a file. I tried changing the extension to .xls for the type of file and then I try to open it with excel in the pda and i get an error