How do I change multiple list items at once in a SharePoint list with ribbon button

Hi
I have a sharepoint list and a ribbon button that open a dialog box with buttons to set color on a row
The problem is that i can only selecet one item at once to set the color. 
How can i do so it could set all or a couple items att once to the color i want 
I want to do this with javascript
here is the code i use to get the item id and the color code is in a seperate js file
'use strict';
var clientContext, hostweburl, parentContext, parentWeb, selectedItem, itemId, listId;
clientContext = new SP.ClientContext.get_current();
hostweburl = decodeURIComponent(getQueryStringParameter("SPHostUrl"));
listId = decodeURIComponent(getQueryStringParameter("SPListId"));
itemId = decodeURIComponent(getQueryStringParameter("SPListItemId"));
parentContext = new SP.AppContextSite(clientContext, hostweburl);
parentWeb = parentContext.get_web();
selectedItem = parentWeb.get_lists().getById(listId).getItemById(itemId);
$(document).ready(function () {
clientContext.load(selectedItem);
clientContext.executeQueryAsync(OnSuccess, OnFail);
function OnSuccess() {
$("#Blue").click(function () {
selectedItem.set_item('Color', 'Blue');
selectedItem.update();
clientContext.load(selectedItem);
clientContext.executeQueryAsync(function () { window.parent.postMessage('CloseCustomActionDialogRefresh', '*'); }, function (sender, args) { alert('Error:' + args.get_message()); });
$("#Green").click(function () {
selectedItem.set_item('Color', 'Green');
selectedItem.update();
clientContext.load(selectedItem);
clientContext.executeQueryAsync(function () { window.parent.postMessage('CloseCustomActionDialogRefresh', '*'); }, function (sender, args) { alert('Error:' + args.get_message()); });
$("#Red").click(function () {
selectedItem.set_item('Color', 'Red');
selectedItem.update();
clientContext.load(selectedItem);
clientContext.executeQueryAsync(function () { window.parent.postMessage('CloseCustomActionDialogRefresh', '*'); }, function (sender, args) { alert('Error:' + args.get_message()); });
$("#Transparent").click(function () {
selectedItem.set_item('Color', 'No Color');
selectedItem.update();
clientContext.load(selectedItem);
clientContext.executeQueryAsync(function () { window.parent.postMessage('CloseCustomActionDialogRefresh', '*'); }, function (sender, args) { alert('Error:' + args.get_message()); });

Check if below can help you
http://sp2010batchedit.codeplex.com/
http://sharepoint.stackexchange.com/questions/35935/use-view-ribbon-custom-action-on-multiple-list-items
http://webcache.googleusercontent.com/search?q=cache:XqMO-PRLHQIJ:dannyjessee.com/blog/index.php/2014/06/enabling-custom-ribbon-buttons-dynamically-based-on-multiple-selected-item-values-using-refreshcommandui-and-jsom/+&cd=1&hl=en&ct=clnk&gl=in
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction Id="DannyJessee.TestCustomAction"
Location="CommandUI.Ribbon"
RegistrationId="100"
RegistrationType="List">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition
Location="Ribbon.ListItem.Actions.Controls._children">
<Button Id="DannyJessee.MarkItemsFinishedButton"
Command="cmdMarkItemsFinished"
Image16by16="/_layouts/images/kpinormallarge-0.gif"
Image32by32="/_layouts/images/kpinormallarge-0.gif"
LabelText="Mark as Finished"
TemplateAlias="o2" />
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler Command="cmdMarkItemsFinished"
CommandAction="javascript:MarkItemsFinished();"
EnabledScript="javascript:EnableFinishedButton();">
</CommandUIHandler>
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
<CustomAction Id="DannyJessee.TestScript"
Location="ScriptLink"
ScriptSrc="/_layouts/15/CustomRibbonButton/CustomAction.js" />
</Elements>
If this helped you resolve your issue, please mark it Answered

Similar Messages

  • How does one change the font size for folders and/or file lists in the Bookmarks Library?

    How does one change the font size for folders and/or file lists in the '''Bookmarks''' Library?
    Since the upgrade to version 9.0.1 of Firefox, the Bookmarks feature changes are confusing me. They seem to be confusing themselves as well. The list of bookmarks has changed. The font size is so small that my aging eyes cannot read it without fogging the screen with my breath. Some folders are out of alphabetical order (where I know they were previously good), and some are missing altogether (folders to which I frequently add references).
    As for missing or deranged files or folders, was there something that I should have done or now need to do to recover those after the upgrade (or before)?
    With regard to font size,
    1. there is no “Edit Bookmarks” or like option to edit the list in this version
    2. the “zoom” option in the “view” list of functions is greyed out when in “Show All Bookmarks” window
    3. expanding the browser window has no effect on font size
    4. “Preferences” settings for font size has no effect in that window either, including advanced settings
    5. “Help” offers none that I can find.
    Can any of you Help?!?

    Maybe this extension helps:
    *Theme Font & Size Changer: https://addons.mozilla.org/firefox/addon/theme-font-size-changer/

  • How do you change multiple songs genre at the same time

    How do you change multiple song's genre at the same time with out during them one a time in ITunes  on Windows 8?

    You can select a range of songs by selecting the first, then holding shift when clicking on the last. You can ctrl+click to add or remove from the selection. Once you have a selection press Ctrl+I to Get Info. Type in the new Genre and press OK.
    tt2

  • When I receive and answer e-mail, the correspondence is usually "nested" with the original message, and the number of replies, etc. are indicated with a number next to the original message.  How can I change the mail settings so that every reply is listed

    When I receive and answer e-mail, the correspondence is usually "nested" "behind"  the original message, and the number of replies, etc. are indicated with a number next to the original message in the inbox.  How can I change the mail settings so that every reply is listed individually in the inbox instead of having them "stacked" behind the original message.  I'm afraid I might accidentially overlook messages the way they are handled now.

    Somebody here will correct me if I'm wrong, but what you have to do is go into Settings, Mail/Contacts/Calendars and under Mail, turn off "Organize by Thread".  I think that will make each message show individually.

  • HT2513 How do you change the name of a reminder in the reminder list.  I right click and then choose "get information"  I can change the colour of the reminder but when I type in the name that I want and then press enter the name stays as "untitled".

    How do you change the name of a reminder in the reminder list.  I right click and then choose "get information"  I can change the colour of the reminder but when I type in the name that I want and then press enter the name stays as "untitled"

    Jerry,
    Thanks for replying again. I've got a little bit further thanks to you. I tried the US keyboard layout as you seemed pretty definte that it should work. This time I applied the setting and also started the language toolbar and selected it from there.
    Hey presto, I've got the @ where it should be. Excellent.
    However the single quote ' works in a weird way. When I press it, it doesn't show up on the screen. But when I press another key, I get the single quote plus the next key I press. When I press the single quote twice, I get 2 of them. This is also the same with the SHIFT ' key. i.e. for the double quotes.
    Very strange. I'll look at other keyboards and see where that gets me.
    Thanks,  Maz

  • How to handle the multiple line items in the Inbound idoc FM

    Hi ,
    Can any body give me how to handle the multiple line item in the idoc when we reprocessing it from workitem....
    Thanks in Advance,,,,
    Regards,
    Bharani

    Hi ,
    Can any body give me how to handle the multiple line item in the idoc when we reprocessing it from workitem....
    Thanks in Advance,,,,
    Regards,
    Bharani

  • Itunes - how do i select multiple line items not in sequence ?

    itunes - how do i select multiple line items not in sequence ?

    Hold down the Command key and click each in succession.
    To extend the selection across items that ARE contiguous, use the Shift key.

  • How can I change all the fonts at once on labels I downloaded from Avery?

    How can I change all the fonts at once on labels I downloaded from Avery?

    select all (Edit > Select All), then open the font panel by selecting the menu item "Format > Font Show Fonts".  Now select the font you want.
    I could only find Templates from Avery for Pages.  I think my suggestion in still good but want you to know you posted this question in the forum for Numbers.

  • Copy List Item Attachment for archiving using SharePoint Designer 2013

    hi,
    how to Copy List Item Attachment for archiving using SharePoint Designer 2013

    1. You can use access:
    http://viziblr.com/news/2011/11/5/batch-exporting-sharepoint-2010-list-item-attachments-using.html
    Or you can try below script
    You can loop through each list item, and get each attachment.
    List<SPAttachment> attachments = new List<SPAttachment>();
    SPList list = SPContext.Current.Web.Lists["My List"];
    foreach (SPListItem item in list.Items)
    attachments.AddRange(item.Attachments.Cast<SPAttachment>());
    If this helped you resolve your issue, please mark it Answered

  • HT1918 How do i change my username to another when they both have accts with itunes one is on my computer and one is on my ipad? Two different e-mail address that are both mine....so how do i make one acct for both?

    How do i change my username to another when they both have accts with itunes one is on my computer and one is on my ipad? Two different e-mail address that are both mine....so how do i make one acct for both?

    If you selected open a new Apple ID account, go back a step and enter use existing Apple ID.
    You will have to set up a separate iCloud account or your iPads will mirror each other.

  • How do i delete  multiple emails at one time from iphone Mail account with iphone 4s?

    how do i delete  multiple emails at one time from iphone Mail account with iphone 4s?

    Better than that!
    http://www.youtube.com/watch?v=fKa-KFjUIGE
    Select a message, hold the move button, deselect the message while still holding the move button.
    A new window appears allowing you to move all messages to the trash.
    Bingo!

  • How can I print multiple PDF files at once using Windows 7?

    How can I print multiple PDF files at once, on an HP LJ Pro 400 xcolocr printer without opening each
    one separately using Windows 7?

    I am sorry, but to get your issue more exposure I would suggest posting it in the commercial forums since this is a commercial printer. You can do this at http://h30499.www3.hp.com/hpeb/
    I hope this helps.
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos Thumbs Up" on the right to say “Thanks” for helping!
    Gemini02
    I work on behalf of HP

  • How can I change my iphone username to update apps and download anything with the new email I have today?

    how can I change my iphone username to update apps and download anything with the new email I have today?

    Before you make an apple ID with the new email, go to appleid.apple.com.  login with your old email and password. change your old email to your new one. Now you can use your new email as your apple id, but beware if you go through the process of creating a new appleid with your new email address you will not be able to attach your old account to your new email.

  • Changing multiple keychain items to the same password

    I work in a corporate environment that uses a Windows server with Active Directory to manage the company network.  Macs are integrated to the network, but Open Directory is not being used.
    The login for the Macs is the same as the network name and password.  Whenever your password is changed on the network, you must update your login keychain to use that password too.  The problem comes with other applications, such as Entourage, that use the same network password but store it in a separate keychain item.  When the login keychain is updated to the new network password, the keychains for these applications are not and must be manually changed.
    Is there any way to synchronize login passwords to keychain items?  Is there a script capable of changing multiple keychains to the same password automatically?  Is there third party software that is able to accomplish either task?  A solution not mentioned?
    Our company is currently using Snow Leopard but plans to migrate to Lion soon, so solutions for any platform are welcome. 
    Thanks to anyone that is able to provide information. 
    Regards,
    JL

    Hi Nishanth,
    1) how to pass value one by one
    in select options..we will be filtering the values in some table..example if s_ebeln is our select-options...then we will be doing a select..like...............
    select fields from vbak into int_vbak  where ebeln in s_ebeln
    so if in the table int_vbak if field ebeln is there ..we will know which all ebeln is there..............
    i.e,if range is 1 to 100 for s_ebeln and 1,2,99 are the only 3 ebeln present in table vbak as of now ...................
    then in select query , we fetch ebeln into int_vbak as an additional field( if it is not a "select *")  we will get all the 3 ebeln 1,2,99 into int_vbak.....so we can pass these fields one by one by looping at int_vbak and appending it to fresh internal table..........
    declare an internal table with ebeln as the field..loop and do the append
    *****putting values of ebeln into a new internal table
    loop at int_vbak.
    wa_ebeln = int_vbak-ebeln.
    append wa_ebeln to int_ebeln.
    endloop.
    *******delete duplicate entries
    sort int_ebeln.
    delete adjacent duplicates from int_ebeln.
    2) how to append and join the data in the v_postab
    First..... declare another table same as v_postab say,v_postabfinal as example...........
    after each "call function"...in the loop ...do the following...
    loop ....
    refresh v_postab[].  "clear before each fxn call
    call function XXXX.
    if v_postab[] is not initial.
    append lines of v_postab to int_postabfinal.
    endif.
    endloop........
    what this append statement does is that every time the internal table has some values..it adds these lines to v_postabfinal without deleting the old entries...so you will have all the values with respect to each value of select-options passed..
    Hope i have made the idea clear with these examples
    Pls check and revert
    Regards
    Byju

  • How to open "Dispform.aspx" in new window or tab in SharePoint List item click.

    Hi,
    I have a SharePoint list.It has column name "Description" which is "Multiple lines of Text" and "<label for="onetidAppendOnly">Append Changes to Existing Text" is Yes.</label>
    Now the view showing the Description <label for="onetidAppendOnly"></label>column value as a "View Entries...". while click the view entries. It showing the records in same window. But
    instead of that i want to open the record in New tab / New window as Popup.
    Is it possible?
    Thanks & Regards
    Poomani Sankaran

    Hi,
    The view itself is a Web Part called an XSLT List View Web Part (XLV for short). This Web Part is stored on an ASPX page that is by default associated with a list or library on your site.
    I suggest you can check if the view page is valid, also, you can try to create another view, then redirect to the view page to see if there is xslt in the page.
    Here are some detailed articels for your reference:
    Create a custom list view using SharePoint Designer
    Using SharePoint Designer 2010 to Work with Web Parts
    How to: Customize the Rendering of a Field on a List View
    Best Regards
    Zhengyu Guo
    TechNet Community Support

Maybe you are looking for

  • Music copyright question?

    I don't know if this belongs here but, alrighty! I'm new to copyright laws etc etc. So I want to be entirely sure before I do anything. Am I or am I not allowed (legally) to get PURCHASED iTunes songs from friends and put them on my computer and iPod

  • How to enhance 2LIS_02_SCL with Conditions

    Dear Gurus, (PLEASE.... THIS ONE IS REALLY AN URGENT ISSUR) I have a situation here, where i have to enhance my Purchasing Data Data Source(2LIS_02_SCL) with the conditions from  MIRO.  Here in our project at the time of creating a PO they enter the

  • Shareable object interface cast problem

    Hi, I'm a student working on building a shareable object interface between two applets namely "EWallet" and "EPhone". I currently use the javacard 2.2.X version and I mean to solve the shareable object interface in this version. Thus not with servlet

  • Abstract Background for SlideShows

    Several questions have come up on how to handle vertical images in a SlideShow. As our video Frame is a horizontal rectangle, to some degree, or another, what does one do with those vertical images - the ones that looked so good, printed and hanging

  • HTTPS and OWN CA

    Hi , Has anyone set up https on XI using there own company's CA to sign the certificates. We are having difficulty with the process. We have followed all the steps in the help pages but when we check https it's showing the certificate to be signed by