Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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;
share|improve this answer
    
items[0] would test always the first element of the list, isnt it? –  Esteban V 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? –  Esteban V Mar 8 '12 at 10:10
    
Error 10 Character '<', hexadecimal value 0x3c is illegal in XML attribute values. –  Esteban V Mar 8 '12 at 10:11
    
cant find how to escape that :( –  Esteban V Mar 8 '12 at 10:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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