Referencing Content Types in List Formatting definitions

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
foreign I'm Chris Let's uh let's talk about some uh list stuff can be exciting all right so we head over to our I know get out of here all right so let's uh get rid of David here all right so we're on a classic Warrior horses site and the uh the horses have noticed um a pattern uh in their sleep lately right so they've decided to start keeping a dream diary uh to see what they can do with that and kind of analyze what's going on and uh man I wish I had turned on Focus mode oh I did but I don't know all right to create a list for that but we're not going to dream diary that uh that's no good for warrior horses so we'll call it uh something more generic say uh night time think thinks that sounds good and we created without the spaces there so that it creates the URL the way I want it and then I go ahead and see that it even knew it for a second there so I'm gonna go ahead and click on it and we're gonna blah blah blah I'm not even sure if that's necessary anymore all right let's save that boom nighttime think things now for our nighttime think things we're gonna be tracking both dreams and nightmares all right so one of the things I've done ahead of this call is I went over to my content type Hub you can believe it so you have a content type Hub too so it is at your you can read that tiny URL it's a content type Hub so it's a site slash content type Hub there you'll find this very exciting site uh which really isn't for anything but the content type so if we go to site settings we can see our content type Gallery here if I go into our site content types and you'll see there are some it's a weird mix we're going to be seeing today in some of these screens uh very old school uh with modern right so it's it's a real mix here sorry we could return to Classic but in this case right any content types we do here we can actually publish out to our various sites there have been a lot of changes thanks to syntax and some other things to make all that work but this is all included with your standard licensing so wow so that's great news all right so what we're going to do is we've got a content type I've already created right so we were to take our category and we're going to filter just so we can see them here and we'll go to horses we'll apply that so I've got this dream content type I've gone ahead and create it so what I can do is I can head back over here to our nighttime think things and when I hit add column you'll notice I don't have any real options here but if I go first to my list settings again we're going to go to this classic settings for the mix of our modern settings we'll go to our classic thing here go to advanced settings and I'm going to say allow management of content types and this is kind of what it's saying here and we're just going to hey okay all right boom now we go back to our list and now we could have tried to go the traditional way of adding content types and all that stuff this is the way to you're going to want to do it now right so you can add column now we've done that we have this add a content type so we're going to click that and now we're going to see all our content types that are available uh you know these are from the content type Hub these do not exist on this site right so we can add our Dream content type now we could just hit apply um it'll add it but we have a couple other options if we click it one we can preview what's in here we can see exact columns that are in here and we get these two options so by default it's going to add a view that's just going to filter on that content type I like that we're going to keep it and then to save time I'm going to go ahead and add the columns to current view if you don't do that you're gonna have to go at them manually right so I'm going to hit apply and wait a second here while it adds that content type and adds those columns to our view and boom it says the there we go now we've got some exciting columns here that's great thank you all right so boom now we got that that's cool and so let's add a uh a dream here so let's just add a friendly Little Dream for fun all right so we have new item new dream which is not quite we want we'll come back to that so we've got a new dream here and we're just gonna say this is rainbows and butterflies that sounds great and uh you know it was beautiful butterflies did stuff it doesn't matter right and this happened uh tonight apparently we're gonna dream about this tonight what were we eating we had some oats all right and we encountered three rainbows and we uh slaughtered two enemies it was a wonderful dream I'm Gonna Save that so that's great so now we've got one of these but what if we want to do you know nightmares we've enabled content types for a reason right so it's a little arbitrary but we're going to add a new content type called nightmare so if we go back to our content type Gallery I'm going to create a content type and call this a nightmare Ryan will say put this in horses and our parent category is going to be list content types and we're just going to pick an item there we go we're not going to do any fancy inheritance with the dream all right so now we've got a nightmare and we're going to add our site columns from existing site columns go to our categories we're gonna go to horses all right and now we're going to add some of those same kind of columns we had before right so we already have the title that comes from item so I'm going to add Vision uh and then what does we have at night right so that the night that the thing happened what snack they were eating but then we don't care about rainbows encountered or enemy Slaughter right this is a this is a nightmare instead we want to know how many hooves are severed right and where the Clown's present perfect all right so let's save that there we go now we've got a content type and we're just going to publish that go ahead and make that available wow let's see what we got here boom so now if we go back to our site well our nighttime thing thinks all right and let's see uh I'm just going to refresh to make sure all right so we refresh and we're going to say you know that same uh add column menu let's click it that way so we can say add a content type or you can see we already have dream loaded but now we should see nightmare so we had nightmare we did the same thing we did before I'm not going to add the columns to the current view that's fine because we already have most of those columns and I don't really want these showing up just yet okay so here we go now we're going to add that all right let's go add that content type and one thing that we're going to want to do just to kind of clean this up is you know I don't want item in there right I just want my dream and my nightmare so I'm going to go back to my list settings that classic settings and I'm going to go down here to the item content type and this is the copy for the list I'm going to say delete this content type I'm just deleting the item content type on this particular list so no worries all right so now when I do that now I don't have that in the drop down right I just have the two things dream and Nightmare so that's awesome so let's add a nightmare and I will call it a rabbit attack all right this is dang rabbits they had saws and said mean thanks those dang rabbits all right that's great and we'll say man we read some some casserole that probably explains a lot of them they severed three three holes but there were no clowns all right so we're gonna save that and let's add one more nightmare here just for fun all right we'll just say uh Jay died Rubio that sounds great Krause I would call that girls and we were definitely more that casserole or we'll say we're eating some oats this time right uh no hoes are sever but they were definitely clowns present all right so we're gonna save that all right so the idea here is um we've got this right so maybe we've we're gonna eliminate some of these columns that are you know are specific to a column type so let's go here and we can hide the column or we can go it'll show hide columns and we'll just do it quicker all right let's remove those two off of there so one of the things here is it's not very easy to distinguish between these right and this is a formatting demo so let's talk about how we're going to format these right so let's come up here and let's format the current View now one of the things we can do is very quickly we can manage our rules here which is very cool where we can add conditional rules where we say like by default don't do anything right but let's say if it's a nightmare we want to do something well unfortunately content type isn't a choice here unless we specifically add it as a column so for now we're just going to pick a random one because we're going to swap it out a minute we're going to say e is equal to nightmare obviously that's not going to do anything because we're not having any titles that are equal to nightmare but we're going to do is we're going to say more styles and let's say no Styles the only thing we want to do is add a border on the left right and we'll say nice and thick and we'll make it uh this red color beautiful so we save that it's not going to do anything because we didn't actually have content type but if we wanted to actually do something on content type now that we've done that we go to advanced mode where we can see it generated the Json for us with exactly what we want the difference is set a link title we don't want that we want it to be content type so to preview that Boop there we go now our nightmares have this little red border so we can easily distinguish them even though we don't have any other columns that are showing that which is really cool all right so we can save that the idea here is we could rewrite this as Excel style thing but why not keep their weird operator operand stuff because it's easy to update now I could also reference content type ID all right let's talk about a capital I and a lowercase D in here and I could reference it by the guide part of the issue with the good is that will not be the good of the content type from The Hub that'll be the full guide of the local copy of the content type in your list now you could easily do it like a starts with to do some of that ID I highly recommend just not messing with that just use the internal name with content type the nice thing is again it's not part of the view you don't have to add it to the view it's always available so wow so there we go there's our additional row class very exciting but let's go a little further all right so let's say we want to create a new view and before I create this I am actually going to add those columns back here because there's a weird thing with the uh The View I want to add where it's not going to add those columns unless they're part of the one you copied the view from so I'm just going to copy all of those for now I'm going to hit apply right and one thing also to note is that this column the site column had a format associated with this custom format right that shows this cloud or not and all that came down and if if I updated the site column on the content type level that will get published down and the publishing just takes 45 minutes to an hour although you can go to your content types here and hit update so just keep that in mind if you're looking for something a little quicker again check out the documentation on that but Okay so we've got this I'm going to create a new view all right so I've got my dream and my nightmare those are the views that create it automatically right and that's what the content type that was that check box one thing I like to do on these by the way is just edit the current view because it bugs me that it's called dream because that was the name of the content type I just have a little s it's very minor but uh it makes me feel better all right so now we've got the idea of Dreams um rather than dream right so let's go back to our all items View and now let's create a new view and we're going to create a board view right and we're just going to call this uh snack distribution because we're pretty sure those snacks have a lot to do with this right so we're going to do that based on the snack all right so what that's going to do is going to create this lovely board View and it's going to sort everything according to the snacks we were eating or the horses were eating before they went to bed and it's created these kind of card views and that's pretty cool right we can actually drag these things around we could say it wasn't oats it was hey right and that's awesome all right it's going to update That Snack field and that's really cool but again we don't really have the content type visible here in a way I'd also want to say one weird thing is this this plus button is going to add a the first content type right so it'll add a dream if you want to specifically choose one you have to choose it up here all right but what we can do is we could say customize card all right we can say yeah we want to show all these fields now one thing to notice this empty cells will not be shown on the card right so by default if you didn't fill out one of these things um you know they're not going to show up here now ours are all required so they're going to show up but all that's really doing is if you go to advanced mode there's a display thing you can just change the format for that okay so that's going to show all of our things and that's very cool but again we want to make a little more obvious what's going on so let's do that all right so if we come over here we've got this idea of our root level has this border right and we can say anything so maybe we just want to set a border around this to say when it's a nightmare let's make it a red border right so very similar that way we can see exactly what's a nightmare and what's not uh we can go with it from there so what we could do is we can add that stuff here so we've got this idea of classes that are being added if you want to know more about these classes we have this lovely grouping so if you go to our main list formatting site and you go to groupings so this is a way to sort samples by class but one of the things I use it for is we list all of them regardless if there are samples or not so this is a great reference just to see what classes are available to you as you can see there's just a whole heck a lot of them right all right so let's come back here but that is where we're getting those I think yeah David's got the link Perfect all right so let's come back over here to our website and one other thing I want to note is some of these classes are very opinionated like border radius doesn't just set a border radius it also turns the Border off so what we're going to do is we're going to remove that because we want the Border so I'm going to pull that out and when I do that it actually it's going to be very tiny border radius will not go to six Ah that's terrible right so if we really are sticklers we want to match exactly right we can restore the Border radius two four pixels to make it exactly that without that exciting class here that's really all that one did so now we've got our four pixels back but that takes away the fact that we had no border that we could set so what we want to do is we want to set that border right so we've got a color here neutral light and if we change that to red now we should see red shows up and that's cool right and if we wanted to change the the size of that right we can we can say here and say border width and we could say what three pixels we can really see it for our demo here okay but the problem is right this is not conditional it's on all of them regardless of their nightmares or not so let's change that right so we don't want three red borders we want to make that conditional so instead of putting it right there let's cut that and let's convert this from just a plane value to an expression so the easiest thing to do is just put an equals and wrap those things in single quotes and now we can add to that string right so say plus and say if and we say content type like that equals equals right nightmare all right well then let's make it that red we talked about right and if it's not that now let's put a quote then we're going to say uh what was that neutral that sounds good neutral so this will be themed based neutral light so now if we do that let's preview aha so now our dream has just that nice gray so it's very easy to tell the difference again you could go uh a lot crazy with this right you get some cool icons you could conditionally show things you could even fully remove you know like have the cards be completely different uh per content type this is a quick demo so we're not going to do all that but that's again this is the basic pattern though where you're gonna just be investigating the content type and then setting Things based on that all right so let's say that let's do one more thing with this just for fun and that's that we're going to come over here and uh now I just noticed it didn't bring our clowns present in as our as our column format reference so that's easy to fix if you ever want to go in there you just hit column format a reference was what's happening with snack but we're going to skip it for now because of time because I want to show you the other thing here which is edit the current view oh one quick thing there's some weird things that the board don't hit customize cardigan it will kill everything so don't do that right or save at least you want to format the current view to be able to get back to that okay so there's a exciting tip so let's format that current View and we're just going to add a little thing right up here and we're going to say command bar props right because we want to do things with that say that we're gonna that'll comma Loop and we say our commands and so with our commands this is just an array of commands we want to apply things to we reference them with key this is referencing these buttons up here so in this case we care about the share right so we don't want people sharing anything but their nightmares we'll say that sounds exciting all right and so the way we do that is we say hide and right so we could say just true and when we say true the share button is gone right but let's do that conditionally instead of true now let's put this equals if and we're going to say uh content type we don't actually need the if because we just needed to reference it so we're gonna say content type content type all right in this case I'm actually going to say not equals uh nightmare right I know that's a little strange right so the reason for that is now we don't have the share button up here right when I click this I can share because it's a nightmare but if I click this I can't share it because it's a dream and the reason is this is really weird because hide is true right so show is false it's a little weird so you just have to think through that logic but the idea is we don't have to write a full if statement or anything else we just need a condition that evaluates true or false okay so let's wrap it up and we're done here okay one last thing here again I mentioned this idea that so I actually presented on this uh four and a half years ago if you could believe it or not and at that time if you added content type it broke everything now it's fine it's fixed so don't worry about that but again I highly recommend using this not this um though you can use both all right and last thing go check out the docs there is a sample that shows how to reference all these things the content type variations which will go through that it also has an emphasis on provisioning and how all that's supported but again all of the format and everything goes to the content type Hub as well so it's an awesome way to use it and uh that's it wow [Music]
Info
Channel: Microsoft Community Learning
Views: 1,434
Rating: undefined out of 5
Keywords: SharePoint, community, open-source, Microsoft, sharepoint, lists, definitions, list, library, JSON, content, type, layout
Id: I_7G32GKlCc
Channel Id: undefined
Length: 17min 41sec (1061 seconds)
Published: Wed Aug 30 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.