سؤال

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى sharepoint.stackexchange
scroll top