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 Answer 1

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;
6
  • items[0] would test always the first element of the list, isnt it? Commented Mar 8, 2012 at 10:03
  • Sorry it was a mistake :) I've updated.
    – Alex Boev
    Commented Mar 8, 2012 at 10:05
  • how can I escape the < character? Commented Mar 8, 2012 at 10:10
  • Error 10 Character '<', hexadecimal value 0x3c is illegal in XML attribute values. Commented Mar 8, 2012 at 10:11
  • cant find how to escape that :( Commented Mar 8, 2012 at 10:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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