Announcement

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

    Refresh tileGrid

    Have you changed something since 4.1p power to 5.0p regarding the tileGrids?
    Similar as here: http://forums.smartclient.com/showthread.php?t=32283
    I am having issues since upgrading to 5.0p which were not in 4.1p.

    I have a tileGrid with one tile, which shows a picture uploaded by the user.
    In the initial download I am observing a viewFile operation:

    Code:
    {
        dataSource:"fotos", 
        operationType:"viewFile", 
        data:{
            f_schueler_id:6212, 
            download_fieldname:"f_foto", 
            download_filename:"aguilas_1.jpg"
        }, 
        textMatchStyle:"exact", 
        showPrompt:false, 
        oldValues:{
            f_schueler_id:6212, 
            download_fieldname:"f_foto", 
            download_filename:"aguilas_1.jpg"
        }, 
        requestId:"fotos$627105", 
        fallbackToEval:false, 
        downloadResult:true, 
        downloadToNewWindow:true, 
        download_filename:"aguilas_1.jpg", 
        lastClientEventThreadCode:"TMR5", 
        bypassCache:true
    }
    which never returns. But, as I read in the forum, this is normal, since the browser does not return any value when the file is downloaded (correct?). So this is fine.

    The issue I have is when the user updates the picture. For this, I have a separate form which is in charge of uploading the picture.
    When the picture is uploaded, I have:
    Code:
    tileGrid.fetchData(c);
    Which correctly creates a dsRequest:
    Code:
    {
        dataSource:"fotos", 
        operationType:"fetch", 
        componentId:"isc_TileGrid_2", 
        data:{
            f_schueler_id:6212
        }, 
        startRow:0, 
        endRow:75, 
        textMatchStyle:"exact", 
        resultSet:[ResultSet ID:isc_ResultSet_20 (dataSource: fotos, created by: isc_TileGrid_2)], 
        callback:{
            caller:[ResultSet ID:isc_ResultSet_20 (dataSource: fotos, created by: isc_TileGrid_2)], 
            methodName:"fetchRemoteDataReply"
        }, 
        willHandleError:true, 
        showPrompt:true, 
        prompt:"Suche Datensätze die den Kriterien entsprechen...", 
        oldValues:{
            f_schueler_id:6212
        }, 
        requestId:"fotos$627108", 
        internalClientContext:{
            requestIndex:4
        }, 
        fallbackToEval:false, 
        lastClientEventThreadCode:"TMR1", 
        bypassCache:true
    }
    which its respective answer:
    Code:
    {
        affectedRows:0, 
        data:[
            {
                title:"This is the title", 
                f_schueler_id:6212, 
                f_foto_filename:"bugatti_royale.jpg", 
                f_foto_date_created:"2015-03-27", 
                f_foto_filesize:16738
            }
        ], 
        endRow:1, 
        invalidateCache:false, 
        isDSResponse:true, 
        operationType:"fetch", 
        queueStatus:0, 
        startRow:0, 
        status:0, 
        totalRows:1
    }
    All of this is correct.
    BUT there is no viewFile request!!!! So I keep seeing the old picture in the tilegrid. And, even I tried different things:
    tileGrid.invalidateCache();
    tileGrid.markForRedraw();
    tileGrid.getTile(0).markForRedraw();
    I keep seeing the old picture.
    SInce there is no viewFile request, I think this is the reason. Could you please check this?

    Using smartgwt 5.0p power 25.03

    #2
    Here you can reproduce the problem:

    EntryPoint
    Code:
    public void onModuleLoad() {
    
    		VLayout layout = new VLayout();
    
    		final TileGrid tileGrid;
    		tileGrid = new TileGrid();
    		tileGrid.setSelectionType(SelectionStyle.NONE);
    		tileGrid.setTileWidth(300);
    		tileGrid.setTileHeight(280);
    		tileGrid.setHeight100();
    		tileGrid.setWidth100();
    		tileGrid.setCanReorderTiles(false);
    		tileGrid.setShowAllRecords(true);
    		tileGrid.setDataSource(DataSource.get("fotos_testcase"));
    		tileGrid.setAutoFetchData(true);
    		Criteria c = new Criteria();
    		c.addCriteria("f_id", 1);
    		tileGrid.setInitialCriteria(c);
    		tileGrid.fetchData(c);
    
    		DetailViewerField pictureField = new DetailViewerField("f_foto");
    		pictureField.setImageHeight(tileGrid.getTileHeight() - 30);
    
    		tileGrid.setFields(pictureField);
    
    		final DynamicForm uploadForm;
    		uploadForm = new DynamicForm();
    		uploadForm.setDataSource(DataSource.get("fotos_testcase"));
    		HiddenItem hi = new HiddenItem("f_id");
    		hi.setValue(1);
    		uploadForm.setSaveOperationType(DSOperationType.UPDATE);
    		FileItem imageItem = new FileItem("f_foto");
    		imageItem.setTitle("foto");
    		uploadForm.setFields(hi,imageItem);
    		IButton uploadButton = new IButton("Upload");
    		uploadButton.addClickHandler(new ClickHandler() {
    
    			@Override
    			public void onClick(ClickEvent event) {
    				uploadForm.saveData(new DSCallback() {
    					public void execute(DSResponse response, Object data,
    							DSRequest request) {
    						SC.say("Uploaded!");
    						Criteria c = new Criteria();
    						c.addCriteria("f_id", 1);
    						tileGrid.fetchData(c);
    					}
    				});
    			}
    		});
    
    		layout.setWidth100();
    		layout.setHeight100();
    		layout.addMembers(uploadForm, uploadButton, tileGrid);
    
    		layout.draw();
    	}
    DataSource:
    Code:
    <DataSource ID="fotos_testcase" serverType="sql" tableName="t_fotos">
    	<fields>
    
    		<field name="f_id" type="sequence" primaryKey="true" />
    		<field name="f_foto" type="imageFile" />
    		<field name="f_foto_date_created" type="date" />
    		<field name="f_foto_filename" type="text">
    			<validators>
    				<validator type="contains" substring=".jpg" />
    			</validators>
    		</field>
    		<field name="f_foto_filesize" type="integer" />
    			
    	</fields>
    
    </DataSource>
    You have to have already an entry in the table with "f_id=1". After uploading a new foto, the old foto is not refreshed.

    Comment


      #3
      Isomorphic, have you been able to reproduce the issue?

      Comment


        #4
        We've applied to a fix to SC 10.0p/SGWT 5.0p and newer that will be in the next nightly builds.

        Comment

        Working...
        X