Contentment Custom DataListSource with BackOffice ...
# help-with-umbraco
r
Contentment continues to amaze me. SO well written. This morning I was thinking about how I could extend a custom DataList. Prepared to ask @leekelleher if I could contribute, I first checked the Docs... what do you know, already there! 10 mins later I have a new custom dataList source. What I'm trying to do now is get a reference to another control (same docType) in the backOffice in an attempt to call different endpoints in my controller. Something like...
Copy code
public IEnumerable<DataListItem> GetItems(Dictionary<string, object> config)
    {
        var items = new List<DataListItem>();
        var thing = _contentmentContentContext.GetCurrentContent(out bool isParent);

        var typeId = thing.Value<int>("pluType");
        var url = $"https://my.api.org/galaxy/plu/{typeId}";

        var response = await _myApiService.GetData(url);
        items = // build items from results
        return items;
    }
Obviously not real code - but hopefully you get the idea https://cdn.discordapp.com/attachments/1184170014740336740/1184170015197495337/image.png?ex=658aff44&is=65788a44&hm=34d9831581cb5435ce10f7ec6ce2af301c57733b6e84be9150b456efb0688fb6&
2 Views