Reusing existing list

Mar 10, 2015 at 6:23 PM
I want to reuse an existing list which is placed in a 2sxc content module on a second tab.
  • If I add a new content module of same type, I need to refill the list again and link to the former items again.
  • If I add an existing module, I cannot apply a different view as it would also change the view on the original (FnL like workflow)
Mar 10, 2015 at 7:17 PM

If you only use it on one place and you want to reuse it you can just query everything in that content type
@using ToSic.Eav.DataSources
    int rowCounter = 0;
    var mid = Dnn.Module.ModuleID.ToString();

    var allItems = CreateSource<EntityTypeFilter>();
    allItems.TypeName = "SampleProduct";

       @foreach (var dict in allItems.List)
            var Content = AsDynamic(dict.Value);
            var cid = Content.EntityId;      
            <li> @Content.Toolbar @Content.Product_Name, @Content.Product_Description </li>
            rowCounter = rowCounter + 1;

You can also set the other module to ouput json and then in your other module loop through the json, there is some sample code on the 2sxc site

If I am not mistaken there is also a setup to query just content of a given moduleid, but im not sure maybe Daniel can shed some more light on this last one
Mar 10, 2015 at 8:18 PM
If you want only the subset of data entered on a specific module, you can use the ModuleDataSource.

But it's probably even easier to just create a pipeline which does that. In 2sxc 6.6.6 the pipeline designer is already included, though not advertised. It's stable, but some features are still missing - but here you could just enter the module-id containing the subset of items you're interested in.

Otherwise you can work with data the way nokiko wrote - retrieving all data and doing with it whatever you want. Again - you would probably benefit from the new pipeline designer.
Mar 10, 2015 at 8:49 PM
Thanks Armand, the code is now working for me. It is a bit confusing that the type of the list items differ from the "normal" list code. Can I link a template to an item type whitout having to enter an item for the module?

I saw the pipeline designer, however I had no idea how to work with it. I guess I will have a ton of questions to ask the 2sic team in Mileau.
Mar 10, 2015 at 10:39 PM
I think it should be possible now to have a template without content type

what I usually do is make a title content type with one field title editing this will allow the temaplte to run as well as allow me to change the module title

I have to play with the pipeline designer as well, working on some large 2sxc client apps so havent had any time to play with that one yet