0

we're customizing a lot of customers sharepoint sites and we need to turn on/off QuickEdit multiple times, I want to create a Bookmarklet to achieve this, but the setting can't be found.

I've tried by changing the SchemaXML of the list, but it doesn't do anything.. Thanks for any advice!

var context = SP.ClientContext.get_current();
var web = context.get_web();
var listTitle = 'MyList';
var list = web.get_lists().getByTitle(listTitle);
var url = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getByTitle('" + listTitle + "')";
var xmlDoc;

// Load the schema XML for the list
context.load(list, 'SchemaXml');
context.executeQueryAsync(function() {
    var schemaXml = list.get_schemaXml();

    // Convert schema XML string to XML DOM object
    var parser = new DOMParser();
    xmlDoc = parser.parseFromString(schemaXml, 'text/xml');

    // Get the List node
    var listNode = xmlDoc.getElementsByTagName('List')[0];

    // Add or update the EnableGridEditing attribute to the List node
    listNode.setAttribute('DisableGridEditing', 'FALSE');

    
    var newSchemaXml = xmlDoc.documentElement.outerHTML;
    console.log(newSchemaXml);
    
    var postBody = JSON.stringify({ '__metadata': { 'type': 'SP.List' }, 'SchemaXml': newSchemaXml });

    $.ajax({
        url: url,
        type: "POST",
        data: postBody,
        headers: {
            "X-HTTP-Method":"MERGE",
            "accept": "application/json;odata=verbose",
            "content-type": "application/json;odata=verbose",
            "X-RequestDigest": $("#__REQUESTDIGEST").val(),
            "IF-MATCH": "*"
        },      
        
        success: function () {
            console.log("List schema updated successfully");
        },
        error: function (err) {
            console.log(err.responseText);
        }
    });
    
    

}, function(sender, args) {
  console.log(args.get_message());
});

1 Answer 1

0

As far I know Quick Edit is not property of the view so edit view property will not help you.
You did not write whether you are looking for Quick edit in classic experience or modern experience (where is called Grid view). But if you are looking for something for classic experience you can try this bookmarklet for enter Quick edit:

javascript:void((function(){var loc = location.href; loc.indexOf("?") == -1 ? (location.href = loc+"?ShowInGrid=True") : (location.href = loc+"&ShowInGrid=True")})());

Please mark this as answer it helps you.

3
  • Thanks for your suggestion! I'll try it on monday.. It's Sharepoint 2013 with SP1.. I dont know about the view type, but the setting made in the advanced list settings usualy affects all views
    – andrey
    Feb 18 at 22:00
  • SharePoint 2013 has only classic UI, so my bookmarklet should help you. And DisableGridEditing is property of the list, which allows you to disable quick edit for all views. So this property should be false if you want to use quick edit. Feb 19 at 5:56
  • This will only work if QuickEdit is enabled for the list, but I want to set DisableGridEditing to false or whatever necessary to change that setting. So my problem is not solved yet, thank you either way.
    – andrey
    Feb 22 at 7:51

Your Answer

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

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