Announcement

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

    ListGrid.setShowRollOverCanvas

    SC_SNAPSHOT-2011-04-26/EVAL Deployment 2011-04-26

    Two strange issues here.

    1) setShowRollOverCanvas setting seems to be ignored. I can force it by setting it inside a ListGrid.addDrawHandler.

    2) I wanted to have a rollover for each cell, so I called listGrid.setUseCellRollOvers(true). I've verified that the coordinates that are passed in are wrong. colNum is off by -1 in each column but the first (as is the rendered canvas position). The effect of this is worse when I use headerspans.

    Does anyone have some working code for the case of listGrid.setUseCellRollOvers(true)? Would greatly appreciate a look at it.

    #2
    This was caused by the fact that one of my fields has ListGridField.setFrozen(true) on it. It looks like rollOverCanvas and frozen cannot be mixed if you want to have setUseCellRollOvers(true)

    Comment


      #3
      Code:
      
      		ListGridField field1 = new ListGridField("1");
      		ListGridField field2 = new ListGridField("2");
      		ListGridField field3 = new ListGridField("3");
      		field1.setType(ListGridFieldType.TEXT);
      		field2.setType(ListGridFieldType.TEXT);
      		field3.setType(ListGridFieldType.TEXT);
      
      		field1.setFrozen(true);
      		field2.setCanEdit(false);
      		field3.setCanEdit(true);
      
      		ListGridRecord record2 = new ListGridRecord();
      		record2.setAttribute("1", "d");
      		record2.setAttribute("2", "e");
      		record2.setAttribute("3", "f");
      
      		ListGridRecord record1 = new ListGridRecord();
      		record1.setAttribute("1", "a");
      		record1.setAttribute("2", "b");
      		record1.setAttribute("3", "c");
      
      		final ListGrid listGrid = new ListGrid() {
      			private Label label;
      
      			@Override
      			protected Canvas getRollOverCanvas(Integer rowNum, Integer colNum) {
      				if (label == null) {
      					label = new Label();
      				}
      				label.setContents(rowNum + "x" + colNum);
      				return label;
      			}
      		};
      		listGrid.setEditByCell(true);
      		listGrid.setCanEdit(true);
      		listGrid.setFields(field1, field2, field3);
      
      		//WHY DOES THIS NOT WORK? -- CALLED IN ONDRAW METHOD
      		listGrid.setShowRollOverCanvas(true);
      
      		listGrid.setUseCellRollOvers(true);
      
      		boolean useDataSource = false;
      		if (useDataSource) {
      			DataSource dataSource = new DataSource();
      			dataSource.setClientOnly(true);
      			dataSource.addField(new DataSourceField("1", FieldType.TEXT));
      			dataSource.addField(new DataSourceField("2", FieldType.TEXT));
      			dataSource.addField(new DataSourceField("3", FieldType.TEXT));
      			dataSource.setTestData(new ListGridRecord[] { record1, record2 });
      			listGrid.setDataSource(dataSource);
      			listGrid.fetchData();
      		} else {
      			listGrid.setData(new ListGridRecord[] { record1, record2 });
      		}
      
      		listGrid.addDrawHandler(new DrawHandler() {
      			@Override
      			public void onDraw(DrawEvent event) {
      				listGrid.setShowRollOverCanvas(true);
      			}
      		});
      
      		addMember(listGrid);

      Bugs:

      1) setShowRolloverCanvas does not work unless it's called in addDrawHandler (this in itself is fishy)

      2) Look at the label shown in the roll over. For the first two columns, it displays colNum = 0, for column 3 it shows colNum = 1

      Comment


        #4
        should I add this to the issue tracker?

        Comment


          #5
          This bug is pretty annoying. Should be an easy fix I would guess.

          This also effects Cell highlighting, with two cells being highlighted (one in the frozen and one in the non-frozen table)

          Comment


            #6
            This is still broken as of last night's build. It means frozen cannot be used with setUseCellRollOvers

            The simpler case is simply to look at cell highlighting with frozen columns:

            Code:
            		ListGridField field1 = new ListGridField("1");
            		ListGridField field2 = new ListGridField("2");
            		ListGridField field3 = new ListGridField("3");
            		field1.setType(ListGridFieldType.TEXT);
            		field2.setType(ListGridFieldType.TEXT);
            		field3.setType(ListGridFieldType.TEXT);
            
            		field1.setFrozen(true);
            		field2.setCanEdit(false);
            		field3.setCanEdit(true);
            
            		ListGridRecord record2 = new ListGridRecord();
            		record2.setAttribute("1", "d");
            		record2.setAttribute("2", "e");
            		record2.setAttribute("3", "f");
            
            		ListGridRecord record1 = new ListGridRecord();
            		record1.setAttribute("1", "a");
            		record1.setAttribute("2", "b");
            		record1.setAttribute("3", "c");
            
            		final ListGrid listGrid = new ListGrid() {
            			private Label label;
            			@Override
            			protected Canvas getRollOverCanvas(Integer rowNum, Integer colNum) {
            				if (label == null) {
            					label = new Label();
            				}
            				label.setContents(rowNum + "x" + colNum);
            				return label;
            			}
            		};
            		listGrid.setEditByCell(true);
            		listGrid.setCanEdit(true);
            		listGrid.setFields(field1, field2, field3);
            		
            		listGrid.setUseCellRollOvers(true);
            
            		boolean useDataSource = false;
            		if (useDataSource) {
            			DataSource dataSource = new DataSource();
            			dataSource.setClientOnly(true);
            			dataSource.addField(new DataSourceField("1", FieldType.TEXT));
            			dataSource.addField(new DataSourceField("2", FieldType.TEXT));
            			dataSource.addField(new DataSourceField("3", FieldType.TEXT));
            			dataSource.setTestData(new ListGridRecord[] { record1, record2 });
            			listGrid.setDataSource(dataSource);
            			listGrid.fetchData();
            		} else {
            			listGrid.setData(new ListGridRecord[] { record1, record2 });
            		}
            
            		listGrid.setWidth100();
            		listGrid.setHeight100();
            		listGrid.draw();
            	}

            Comment


              #7
              Is there a chance this will be fixed soon? Otherwise, I will start implementing my own frozen columns (keeping two ListGrid instances in sync).

              Comment

              Working...
              X