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
add comment

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? –  L.V. Sharepoint Architect 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? –  L.V. Sharepoint Architect Mar 8 '12 at 10:10
    
Error 10 Character '<', hexadecimal value 0x3c is illegal in XML attribute values. –  L.V. Sharepoint Architect Mar 8 '12 at 10:11
    
cant find how to escape that :( –  L.V. Sharepoint Architect Mar 8 '12 at 10:25
show 1 more comment

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.