Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Steve Morgan 1278 posts 4216 karma points c-trib
    Sep 08, 2015 @ 10:59
    Steve Morgan
    0

    Grid Content - Get a simple concatenated string of all rte / text values

    Hi,

    I've managed to insert the grid content into my Examine index. I'd like to generate and show a preview of the text content in the search results.

    I just thought it would be easy to quickly grab the values (where they are RTE or text) and concatenate and strip HTML).

    I can't quite get the query right... I've got this far but all I'm selecting is the first row which has an RTE field - I want all "value" fields into an array where the editor-.>alias == rte or text. Has anyone managed to do this?

     var jsonGridContent = JObject.Parse(result.GetPropertyValue<string>(field));
    var test = jsonGridContent["sections"][0]["rows"].Children()["areas"].Children()["controls"].Where(x => (string)x.Children()["editor"].FirstOrDefault()["alias"].Value<string>() =="rte");
        string gridValues = string.Join(" ", test.Values<string>().ToArray<string>());
    

    I've seen the rather excellent looking GridData plugin but it looks a bit overkill just for this?? https://github.com/skybrud/Skybrud.Umbraco.GridData

    Steve

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies