Announcement

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

  • 11.1p BatchUploader validator problem / problem with Autofit for boolean fields with validation errors

    Hi Isomorphic,

    please have a look at this modified testcase (v11.1p_2018-01-07), where I think that all columns should have validation errors.
    The SKU column now needs to be like a Zipcode and In Stock is required. Both conditions are not met, IMHO.

    It is possible that I made an error in JS here, but I don't think so.
    I made the testcase because in my application I have a problem with required boolean fields (like here "In Stock"), which do not accommodate space for the the validation-error icon when autofitting.
    I think this should happen as well in the testcase, once the validation error is being shown.

    BatchUploader modification:
    Code:
    isc.BatchUploader.create({
        ID:"uploader",
        height: 400,
        width: "100%",
        uploadDataSource: supplyItemCustom,
        // BatchUploader supports extra fields, which are uploaded along with the file 
        // data and can be accessed from the HttpSession on the server side; here we
        // define some fields to be used in this way
        uploadFormFields: [
            { name: "stringValue", title: "String Value", type: "text", wrapTitle: false },
            { name: "numericValue", title: "Numeric Value", type: "number", wrapTitle: false }
        ],
        // We have limited vertical screen space when running in the Feature Explorer, 
        // so we force the embedded grid to be quite short in an attempt to avoid 
        // the need for page scrolling
        gridProperties: {
            height: 200,
            autoFitWidthApproach: "both",
        },
        gridFields: [{ name: "itemID" },
        { name: "itemName" },
        { name: "SKU", validators:[
            {type:"regexp", expression:"^\\d{5}(-\\d{4})?$", 
                errorMessage:"Zip Codes should be in the format ##### or #####-####."}
        ] },
        { name: "description" },
        { name: "category" },
        { name: "units" },
        { name: "unitCost" },
        { name: "inStock", required: true, title: "Foobar" },
        { name: "nextShipment" }]
    });
    Best regards
    Blama



  • #2
    You need your validator to be declared server-side for it to work with the BatchUploader. It's invisible to the initial upload process right now.

    Autofitting does not take into account the validation icon as this would cause column sizes to adjust in a bouncy, annoying way during user input.

    Comment


    • #3
      Hi Isomorphic,

      thanks for the hint on the server-side validation. Then of course it is not possible in a modified showcase sample.

      But you already address the base question in the 2nd paragraph. I'm not talking about ongoing Autofit, but about the the one-time Autofit via the column-header menu. Here the width is is too low IMHO.

      Please see this modified sample:
      Code:
      isc.ListGrid.create({
          ID: "countryList",
          width:500, height:300, alternateRecordStyles:true, modalEditing: true,
          dataSource: worldDS, canEdit: true,
          fields:[
              {name:"pk", title:"PK", width:30},
              {name:"countryCode", width:60},
              {name:"countryName"},
              {name:"member_g8", validators:[{type:"required"}], editorProperties:{allowEmptyValue:true}},
              {name:"capital"},
              {name:"continent"},
              {name:"area", validators:[{type:"required"}]}
          ],
          autoFitWidthApproach: "both",
          autoFetchData: true,
          showFilterEditor: true,
          filterOnKeypress: true
      });
      Edit the G8 field to be null and then leave the row. A validation error will appear.
      Then do an one-time autofit and you'll see that not the whole column is visible.
      I think that an minWidth:50 as default for boolean fields will fix this.

      Best regards
      Blama

      Comment


      • #4
        In the rare case that someone applies a validator to a boolean field in a grid row, we would recommend they set a width wide enough to accommodate the possible error icon. Leaving space for a possible error icon on all boolean fields would be a bad framework default, in the autofit case or not.

        Comment


        • #5
          Hi Isomorphic,

          you are right. Thinking about it, BatchUploader is the only case for BooleanItems, where I could get a null value for a required field. In all other cases, a default value of false does handle this for me.
          So I'll go with the minWidth:50 for BatchUploader-boolean fields.

          Thank you & Best regards
          Blama

          Comment

          Working...
          X