Cos then I'd have to query the whole list.

The 2010 JS library allows you to query selected list items using the
getSelectedItems List Operation.

var selectedItems = SP.ListOperation.Selection.getSelectedItems();
var selectedItemIds = '';
var selectedItemIndex;
for (selectedItemIndex in selectedItems){
   selectedItemIds += '|' + selectedItems[selectedItemIndex].id;
}

I then render them in my modaldialog using this pattern:

<asp:DataList ID="SelectedDocumentsDataList" runat="server"
RepeatColumns="2" CellPadding="2" CellSpacing="5">
  <ItemTemplate>
    <li><%# DataBinder.Eval(Container.DataItem,
"File.Name").ToString()%></li>
  </ItemTemplate>
</asp:DataList>

What I am trying to do is filter this further by only displaying items
whose filename ends with doc or docx. But I'm not sure of the best method
to use. :(

I'm already performing this with the code behind so that only Word docs are
converted. But I want to show this list to the user as well.

foreach (SPListItem listItem in _selectedListItems)
{
  //Verify the document added is a Word Document
  //  before starting the conversion.
  if (listItem.Name.EndsWith(".docx") || listItem.Name.EndsWith(".doc"))
  {
    //do stuff
  }

Better still I'd like to render unsupported filetypes in red or
strikethrough text. But I just don't know how to indiviudally define
supported and unsopported docs within my slecteditems var.

ya dig? ;)

On 18 July 2012 16:14, Maxine Harwood <maxinetechg...@gmail.com> wrote:

> Not sure if i follow what you wanted to achieve, but why not just query
> the items file extension?
>
> Sent from Max's iPad
>
> On 18/07/2012, at 3:15 PM, Web Admin <web.ad...@syd.catholic.edu.au>
> wrote:
>
> Hi all,
>
> I'm writing a CommandUIHandler for a custom Ribbon button which retrieves
> the currently selected items in the list and displays them in a modal
> dialog.
>
> var selectedItems = SP.ListOperation.Selection.getSelectedItems();
>
> var selectedItemIds = '';
> var selectedItemIndex;
> for (selectedItemIndex in selectedItems) {
>     selectedItemIds += '|' + selectedItems[selectedItemIndex].id;
> }
>
> I want to try taking this a step further by only returning selected items
> whose *Name* EndsWith ".doc" or ".docx". I can achieve this easily enough
> in C# but am struggling with JavaScript and don't want to start using Regex
> and manipulating array strings. :|
>
> I'm not sure how (or whether it's possible) to grab the Name value at all
> in this way?
>
> Regards,
>
> Paul (new email)
>
> SharePoint Farm Admin/Developer
> Infrastructure Team
> CEO Sydney
>
> p: (02) 9568 8461
> f: (02) 9568 8483
> e: paul.no...@syd.catholic.edu.au
> w: http://www.ceosyd.catholic.edu.au/
>
> _______________________________________________
> ozmoss mailing list
> ozmoss@ozmoss.com
> http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
>
>
> _______________________________________________
> ozmoss mailing list
> ozmoss@ozmoss.com
> http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
>
>


-- 
Regards,

Paul Noone

--
SharePoint Farm Admin/Developer
Infrastructure Team
CEO Sydney

p: (02) 9568 8461
f: (02) 9568 8483
e: paul.no...@syd.catholic.edu.au
w: http://www.ceosyd.catholic.edu.au/
_______________________________________________
ozmoss mailing list
ozmoss@ozmoss.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss

Reply via email to