Return CurrentItem from context.Templates.Item JSLink
-
29-09-2020 - |
سؤال
Any ideas on how to return from the Custom Item method when using JSLink (as if it was never called)? I want to do a check in this method and hide the row if the condition fails. I know I can do a PostRender, but then I will have to loop through each row again.
overrideContext.Templates.Item = customItem;
function customItem(context) {
if(conditionIsNotMet)
return context.ListData.Row;
else
//Hide Row somehow
//Tried return context.CurrentItem, return null, return "", return context.ListData
}
المحلول
Have you seen this post: Filter out items in list view using jslink
Looks like you could do:
overrideContext.Templates.Item = customItem;
function customItem(context) {
if(conditionIsNotMet) {
return RenderItemTemplate(context);
}
else {
return ''; //Hide Row somehow
}
}
HTH
لا تنتمي إلى sharepoint.stackexchange