Data Container function: getDataContainerRecordsForElement

Returns the records published for the page pageId and the element elementId.

The pageId and elementId parameters are provided in the elementView in the SDK callback layoutSubviews.

Example for getDataContainerRecordsForElement
@objc class func layoutSubviews(_ elementView: UserCustomElement) {
        var s = "";
        s = myDataContainerValues(elementView: elementView)
}

class func myDataContainerValues(elementView: UserCustomElement) -> String {
    var s = ""
    
    if let arrItems = CDockSDK.getDataContainerRecordsForElement(byPageId: elementView.templateId, elementId: elementView.elementId, orderBy: "myField", orderDirection: "desc") as? [[String: String]] {
        for dict in arrItems {
            s = s + "\n\n>>> FIELDS:"
            for (key, value) in dict {
                s = s + "\n"
                s = s + (key + ": " + value)
            }
        }
    }

    return s
}

Parameter:

  • byPageId = The page ID from the elementView.
  • elementId = The element ID from the elementView.
  • orderBy= The field name to sort by. The field names are returned with the function getDataContainerFields.
  • orderDirection= the values desc and asc are possible.

More information


Feedback or Questions

We are always happy to help you with questions about the code or other questions.

Was this page helpful? Yes No

Topics on this page