Copied to clipboard

Flag this post as spam?

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


  • Sean Dooley 273 posts 490 karma points
    Aug 01, 2011 @ 16:27
    Sean Dooley
    0

    'umbraco.MacroEngines.DynamicXml' does not contain a definition for 'Skip'

    I am looking at paging a ucomponents multi-node tree picker property, but it returns dynamic xml data which does not contain a definition for 'Skip' or 'Take'.

    How can I go about using Skip and Take, like follows, on DynamicXml?

    var pagesToList = @Model.Children;
    @foreach(var item in pagesToList.Skip(currentPage*itemsPerPage).Take(itemsPerPage)) { ... }

     

  • Doogie Talons 183 posts 318 karma points
    Mar 27, 2012 @ 12:25
    Doogie Talons
    0

    Sorry to bump but did you discover a solution for this I am trying to page some xml which returns in DynamicXml 

    Doogie.

  • Sean Dooley 273 posts 490 karma points
    Mar 27, 2012 @ 15:14
    Sean Dooley
    0

    Hi Doogie

    I actually can't remember. Think I abandoned my original idea as couldn't find a solution.

    Quick search found this post http://our.umbraco.org/forum/developers/razor/27730-DAMP-Paging-error-(umbracoMacroEnginesDynamicXml-contains-no-definition-for-Skip)

    Possibly use Library.NodesById as described in the Umbraco Razor Snippets http://umbraco.com/follow-us/blog-archive/2011/9/22/umbraco-razor-feature-walkthrough%E2%80%93part-8.aspx

    Might be able to pass all the IDs in to return a DynamicNodeList and see if you can use Skip and Take

    Also look at uComponents helper methods, in particular GetNodesByXml

    http://ucomponents.codeplex.com/wikipage?title=uQuery&referringTitle=Documentation

    http://our.umbraco.org/wiki/reference/code-snippets/razor-snippets/get-values-from-ucomponents-multi-node-tree-picker-multiple-textstring

  • Sean Dooley 273 posts 490 karma points
    Mar 27, 2012 @ 15:40
    Sean Dooley
    0

    Possible working solutions as follows

    var nodes = uComponents.Core.uQuery.GetNodesByXml(CurrentModel.GetPropertyValue("multiNodeTreePicker", true));
    foreach(var n in nodes.Skip(1 * 1).Take(1)) {
      @n.Name
    }

    or

    @{
      var nodes = Library.NodesById(Model._nodePicker.Split(','));
    }
    @foreach (var n in nodes.Skip(1 * 1).Take(2)) {
      @n.Name<br />
    }

    Hope this helps

  • Doogie Talons 183 posts 318 karma points
    Mar 27, 2012 @ 16:11
    Doogie Talons
    0

    Yeah I was more dabbling with the Skip Take ext, I was mixing some code up to see if it would work trying to mix DynamicXml with  the paging example in umbraco 4.7.1 

    I thought it would be fairly simple :)

  • 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