Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Pre-defined hilites do not work (immediately)

    When applying pre-defined hilites, they do not work immediately. When calling ListGrid.editHilites and then pressing save, they work.

    I have this is issue on SC_SNAPSHOT-2011-05-25/PowerEdition Deployment (built 2011-05-25), GWT 2.1.0 and Firefox 4.

    Code:
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.data.Criterion;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.data.Hilite;
    import com.smartgwt.client.types.OperatorId;
    import com.smartgwt.client.widgets.IButton;
    import com.smartgwt.client.widgets.events.ClickEvent;
    import com.smartgwt.client.widgets.events.ClickHandler;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridField;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class HiliteTest implements EntryPoint {
    	
    	private static final Hilite[] HILITES = new Hilite[]{
    		new Hilite() {{  
                setCriteria(new Criterion("cstm_pk", OperatorId.EQUALS, 1));  
                setBackgroundColor("#FF0000");   
                setId("0");
            }},
    	};
    	
    	public void onModuleLoad() {
    		final ListGrid listGrid = new ListGrid();
    		DataSource ds = DataSource.get("Customer");
    		
    		ListGridField name = new ListGridField("cstm_name", "name");
    		ListGridField pk = new ListGridField("cstm_pk", "pk");
    		
    		listGrid.setFields(pk, name);
    		listGrid.setDataSource(ds);
    		listGrid.setAutoFetchData(true);
    		listGrid.setHilites(HILITES);
    		
    		IButton button = new IButton("edit hilites");
    		button.addClickHandler(new ClickHandler() {
    			@Override
    			public void onClick(ClickEvent event) {
    				listGrid.editHilites();
    			}
    		});
    		
    		VLayout vLayout = new VLayout();
    		vLayout.addMember(listGrid);
    		vLayout.addMember(button);
    		vLayout.setHeight100();
    		vLayout.setWidth100();
    		vLayout.draw();
    		
    		
    	}
    
    }
    Code:
    <DataSource 
    	serverType="sql"
    	dbName="Mysql"
    	tableName="Customer"
    	ID="Customer"
    >
    	<fields>
    		<field primaryKey="true" type="sequence" name="cstm_pk" hidden="false"></field>
    		<field type="text" length="45" name="cstm_name" title="" required="true" export="true"></field>
    	</fields>
    </DataSource>

    #2
    Thanks for the report - we've added a fix and you'll see it in upcoming nightlies

    Comment


      #3
      Is there any work around for the 2.4 build ?

      Comment


        #4
        Yes, a very simple one - instead of (or as well as) setting hilite.backgroundColor, you need to set the cssText for it (also for "color", if want to set the text color) - so, set
        Code:
        hilite.cssText = "background-color: #FF0000;"

        Comment


          #5
          Hello, I have a similar problem :

          SmartClient Version: v8.3p_2013-07-24/PowerEdition Deployment (built 2013-07-24)
          Chrome Version 38.0.2125.111 m

          I set hilites on a ListGrid and after I set the dataSource and call fetchDataMethod to retrieve data.

          The hilites doesn't show until I put the mouse on the record.

          I tried to redraw the grid after the dataSourceCallback but nothing to do they doesn't hilite the record until I pass the mouse on the row.4

          The code :

          Code:
          Hilite hilite = new Hilite();
                  hilite.setFieldNames(type.name());
                  hilite.setCriteria(new AdvancedCriteria("colName", OperatorId.NOT_NULL));
                  hilite.setCssText("font-size:0px;color:#0AF619;cursor:pointer;"
                              + "background:#0AF619 url('images/icons/search.png') no-repeat;");
          
          ListGrid grid = new ListGrid();
          grid.setHilite(new Hilite[] {hilite});
          grid.setDataSource(...);
          grid.setFields(...);
          On the first display the css background is set to :
          Code:
          "#0AF619 url('" (broken)
          And after we put the mouse on :
          Code:
          #0AF619 url('images/icons/search.png') no-repeat;
          Thx in advance.

          Edit : I found a fix : ... url(\"images/icons/search.png\") ...
          Last edited by Emilien; 4 Nov 2014, 09:27.

          Comment

          Working...
          X