1

This script works but only for one selected item

 EnabledScript="javascript:
              var items = SP.ListOperation.Selection.getSelectedItems();
              (items.length == 1 && items[0].fsObjType == 0);"/>   

I need that the user can select many files or folder. If in the selection there is at least one folder, button should be disabled, if all items are just files, button should be enabled

1

I guess you can use something like this (not tested):

for (int i =0; i < items.length; i++)
{
   if (items[i].fsObjType == 1)
      return false;
}
return true;
  • items[0] would test always the first element of the list, isnt it? – Luis Valencia Mar 8 '12 at 10:03
  • Sorry it was a mistake :) I've updated. – Alex Boev Mar 8 '12 at 10:05
  • how can I escape the < character? – Luis Valencia Mar 8 '12 at 10:10
  • Error 10 Character '<', hexadecimal value 0x3c is illegal in XML attribute values. – Luis Valencia Mar 8 '12 at 10:11
  • cant find how to escape that :( – Luis Valencia Mar 8 '12 at 10:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.