Jump to content
  • 0

Bulk Edit Redirect on Update


DesiLogi

Question

Hi, 

I have a tabular datapage that I'm using Bulk Edit to update selected records. When the 'Update' button is clicked I need to redirect to another url (using some parameters passed). I've tried a number of methods but can't seem to get it to work. 

- tried a custom 'update' button in an html block but it doesn't actually update the selected records (perhaps this is because and 'Update' on a Bulk Edit isn't the same as on a Details page?)

- tried to modify, in Localization, the Bulk Edit text with html code for the redirect url but it just shows the html markup in the button. Not sure if there's a way to do this there but it seems like it'd be cleanest if so. 

Any help would be greatly appreciated- 

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 1

In case anyone needs a solution on this.

1) create a tabular datapage that uses as a filter the field you will be updating (so that when that field is updated in Bulk Edit those records will be filtered out of the results upon refresh)

2) use js to auto-select all and open Bulk Edit on load of tabular datapage: 

    In header to reference jquery:

     

<script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>

 

   In the footer: 

<script>
 
$(document).ready(function(){
 
setTimeout(function() {
var checkboxes = $("input[type='checkbox']");

for (i = 0; i < checkboxes.length; i++ ) {
  $(checkboxes[i]).prop('checked', true);
}

$("[data-cb-name='BulkEditButton']").click();

}, 10);
 
});
</script>

 

3) change the localization so that msg "no records found" is the redirect url you need. 

When the user opens the results page all records will be selected and Bulk Edit will open. They click Update (you need to configure what will be updated) and then all those records will be updated and the page's filter will therefore filter them out, causing the 'no records found' msg to kick in, and therefore your redirect url for that message. 

 

It's a bit of a workaround and only works if all records are to be selected but it's something. 

Link to comment
Share on other sites

  • 1

The last CB update broke the code I was using for this. Apparently, (document).ready doesn't work anymore.  This is the code Caspio recommended to use now. It will select all records in the results and automatically open the Bulk Edit form.

<script>
document.addEventListener('DataPageReady', function (event) {
  if (event.detail.appKey == 'c2104000906ceabdc5f14cef8726') {
    setTimeout( function() {
      $( '#ToBulkDelete > input[type="checkbox"]' ).click();
      $("[data-cb-name='BulkEditButton']").click();
    }, 10 );
  }
});
</script>

 

Link to comment
Share on other sites

  • 0

Thanks for the answer anyway. The link/msg in the host page are the last resort but it's very clunky to do so. 

I almost found a way to do this- if the datapage filters out records that have been updated with what the Bulk Edit is to update, and user does a 'select all' for the Bulk Edit, you can put script into the localization for 'no records found' that redirects to another page after the Bulk Edit update (because the page refreshes and the updated records are filtered out). This works well. The only problem is if the user doesn't 'select all' so some records are left on the datapage. Then there's no explanation giving, no redirection.

I actually want to use 'select all' and this would work- except I can't figure out how to force the user to 'select all' records (without relying on a msg, which no one ever pays attention to). If I could have the datapage open with all records selected automatically- that would also solve the problem. If anyone knows how to do that please post- thanks.

Link to comment
Share on other sites

  • 0

Hi. 

 

I've been using this script which was working perfectly through last week. Currently, it selects the checkboxes but now fails to select the bulk edit link. I'm not sure how to update the script to open the link. Any assistance would be appreciated. 

 

Thanks. 

Bre

Link to comment
Share on other sites

  • 0

Hi Carlson, 

Thanks so much for the feedback. The update seems to have affected some of my scripts and my delete triggers. Grateful that you will be sharing your troubleshooting results  with the community. 

Many Thanks!

 

Bre

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...