Announcement

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

    DataSource.getFileURL() PK / criteria issue

    Hi Isomorphic,

    please see this testcase and upload the file a 2nd time.
    As you will see, the images below the ListGrid now show broken images. This is because the DB Select does return more than one row, making the Servlet throw an exception.
    Right now I'm using
    Code:
    src: mediaLibrary.getFileURL(1),
    as this seems to be correct w.r.t. to the docs:
    data - Record or value of primary key field for record containing the file to view.
    It is also not working like this (See the ListGrid Response in the Developer Console for an existing title value):
    Code:
    var record2 = {};
    record2.title = "TEST"; //If the title you chose is TEST
    
    isc.Img.create({
        ID: "img2",
        src: mediaLibrary.getFileURL(record2),
        size: 150,
    });
    It is working like this (See the ListGrid Response in the Developer Console for an existing pk value):
    Code:
    var record1 = {};
    record1.pk = 2;
    
    isc.Img.create({
        ID: "img1",
        src: mediaLibrary.getFileURL(record1),
        imageHeight: 150, //imageType: "center",
        imageWidth: 150
    });
    Best regards
    Blama

    #2
    We've made a change to address this issue. Please try the next nightly build, dated May 25.

    Regards
    Isomorphic Software

    Comment


      #3
      Hi Isomorphic,

      it is not working in v11.1p_2018-05-26.

      Full testcase:
      Code:
      isc.DynamicForm.create({
          autoDraw: false,
          ID: "uploadForm", width: 300,
          dataSource: mediaLibrary,
          fields: [
              { name: "title", required: true },
              { name: "image", type: "imageFile", hint: "Maximum file size is 5 MiB" },
              { title: "Save", type: "button", 
                  click: function () {
                      this.form.saveData("if(dsResponse.status>=0) uploadForm.editNewRecord()");
                  }
              }
          ]
      });
      
      isc.ListGrid.create({
          autoDraw: false,
          ID: "mediaListGrid",
          width: "100%",
          height: 224,
          alternateRecordStyles: true,
          dataSource: mediaLibrary,
          canRemoveRecords: true,
          autoFetchData: true
      });
      
      var record1 = {};
      record1.title = "SVG"; //If the title you chose is SVG
      
      isc.Img.create({
          ID: "img1",
          src: mediaLibrary.getFileURL(record1),
          imageHeight: 150,
          imageWidth: 150
      });
      
      var record2 = {};
      record2.title = "PNG"; //If the title you chose is PNG
      
      isc.Img.create({
          ID: "img2",
          src: mediaLibrary.getFileURL(record2),
          size: 150,
      });
      
      isc.VLayout.create({
          autoDraw: false,
          ID:"imgLayout",
          width:"100%",
          height:190,
          padding: 50,
          members:[img1, img2]
      });
      
      isc.VLayout.create({
          autoDraw: false,
          ID:"mainLayout",
          width:500,
          height:250,
          members:[mediaListGrid, imgLayout]
      });
      
      isc.HStack.create({
          width:"100%",
          membersMargin: 10,
          members:[uploadForm, mainLayout]
      });
      Best regards
      Blama

      Comment


        #4
        This testcase is invalid: getFileURL() requires the PK to be present in the passed Record, whereas you've passed the title.

        We do see that the docs say "Record or value of primary key field for record" so we'll clarify that to be more explicit that a passed record must contain the PK, and not just criteria.

        Comment

        Working...
        X