Announcement

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

    #16
    Check for typos or other problems unrelated to ViewFileItem.

    Here's a working test case. To run, use the Admin Console to generate a table for the the mediaLibrary DataSource, run the Smart GWT code, upload a file using the form at the top, reload the page and the bottom form shows the file (since it's the first record, fetchData() grabs it).

    Code:
    	    final DynamicForm uploadForm = new DynamicForm();
    	    uploadForm.setDataSource(DataSource.get("mediaLibrary"));
    	    uploadForm.draw();
    	    
    	    IButton saveButton = new IButton("Save");
    	    saveButton.setTop(100);
    	    saveButton.addClickHandler(new ClickHandler() {
    	         public void onClick(ClickEvent event) {
    	        	 uploadForm.saveData();
    	         }
    	    });
    	    saveButton.draw();	 
    	    
    	    DynamicForm viewForm = new DynamicForm();
    	    viewForm.setTop(200);
    	    viewForm.setDataSource(DataSource.get("mediaLibrary"));
    
    	    ViewFileItem target = new ViewFileItem("image");
    	    target.setAttribute("editorType", "ViewFileItem");
    	    target.setType("imageFile");
    
    	    viewForm.setItems(target);
    	    viewForm.fetchData();
    	    viewForm.draw();
    mediaLibrary.ds.xml:

    Code:
    <DataSource ID="mediaLibrary" serverType="sql">
        <fields>
            <field name="pk" type="sequence" hidden="true" primaryKey="true"/>
            <field name="title"/>
            <field name="image" type="imageFile"/>
        </fields>
    </DataSource>

    Comment


      #17
      Fixed. You will no longer need to call target.setAttribute("editorType", "ViewFileItem") and target.setType("imageFile").

      Fix will be present in the next nightly build.

      Comment

      Working...
      X