2017 June Release

Properties of the Object Class “jQuery Control”Permanent link for this heading

Following properties of the object class jQuery Control (FSCVAPP@1.1001:ControljQuery) are commonly used. Properties that are not listed here are intended for internal use only. The examples are not self-contained, but they put focus on the important points.

FSCVAPP@1.1001:initexprPermanent link for this heading

FSCVAPP@1.1001:initexpr provides initial data for the control (e.g. strings). The result value has to be in JSON format.

Example

app.ducx Object Model Language

instance ControljQuery CustomObjectListControl {
  ...
  // provides initial data for the control
  initexpr = expression {
    string[] names;
    for (Object obj : ::value) {
      names += obj.GetName();
    }

    // the dictionary contains the desired values
    dictionary initvals = {
      strings: {
        RemoveEntry: #StrRemoveEntry.Print()
      },
      names: names
    };

    // convert the dictionary to a JSON string
    return coouser.Value2JSON(initvals);
  }
}

render.js

this.OnInit = function CustomObjectListControl_OnInit()
{

  // get the values defined in initexpr
  var init = this.GetInit();

  this.strings = init.strings;
  this.names = init.names;

  if (this.names) {
    if (typeof this.names == "string") {
      this.names = [this.names];
    }
  }
};

this.OnRender = function CustomObjectListControl_OnRender(output)
{
  if (this.names) {

    for (var idx = 0, cnt = this.names.length; idx < cnt; idx++) {
      ...
      output.Push(this.names[idx]);
      ...
      output.Push(this.strings.RemoveEntry);
    }
  }
}

FSCVAPP@1.1001:lookelementsPermanent link for this heading

FSCVAPP@1.1001:lookelements defines resources (JS, CSS and images) needed for the control. JavaScript and CSS files are automatically included in the HTML page.

Images can be accessed within the HTML code using following path:

../tmp/x/<SWCREF>_<majorid>_<minorid>/<imagename>.<ext>

In CSS files use the following path:

../x/<SWCREF>_<majorid>_<minorid>/<imagename>.<ext>

Example

app.ducx Object Model Language

instance ControljQuery CTRLEditImage {
  ...
  lookelements<lookbasename, COOSYSTEM@1.1:component, lookcontent> = {
    { "editimage.js", FSCIMAGE@1.1001, file("resources/js/editimage.js") },
    { "render.js", FSCIMAGE@1.1001, file("resources/js/render.js") },
    { "jquery.Jcrop.min.js", FSCIMAGE@1.1001, file("resources/js/jquery.Jcrop.min.js") },
    { "jquery.Jcrop.css", FSCIMAGE@1.1001, file("resources/css/jquery.Jcrop.css") },
    { "Jcrop.gif", FSCIMAGE@1.1001, file("resources/css/Jcrop.gif") }
  }
}

render.js

this.OnRender = function CTRLEditImage_OnRender(output)
{
  output.Push("<img src=\"../tmp/x/FSCIMAGE_1_1001/Jcrop.gif\" alt=\"\" />");
}

COOATTREDIT@1.1:controltypesPermanent link for this heading

COOATTREDIT@1.1:controltypes can be used to document for which data types the control is applicable for (e.g. INTEGER, OBJECT, OBJECTLIST, Content, WorkFlowParticipant).

Example

app.ducx Object Model Language

instance ControljQuery CustomObjectListControl {
  controltypes = { OBJECTLIST, OBJECTLISTUNIQ }
  ...
}