Hi everyone
Playing around with batch actions, and wondering if the are other arguments available than (table_name, ids)?
I would like to use a argument like (table_name, array_of_content_from_column3, array_of_content_from_column6). Would that be possible?
Best regards, Søren
Batch actions
Re: Batch actions
I actully got it working, with an Ajax call for retrieving the needed data for the clipboard. It all works just fine .. but only when using Chrome. Other browsers are preventing me from writing to the clipboard - and i'm kinda stuck.
I know this is becomming more of a Javascript question, rather than a AppGini question - but perhaps some Javascript aficionado could share a hint?
I know this is becomming more of a Javascript question, rather than a AppGini question - but perhaps some Javascript aficionado could share a hint?
Code: Select all
function CopyPackageNames(table_name, ids){
var query = 'table=' + table_name;
for(var i = 0; i < ids.length; i++){
query = query + '&'
+ encodeURI('ids[]') + '='
+ encodeURIComponent(ids[i]);
}
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
// navigator.permissions.query({name: "clipboard-write"}).then(result => {
// if (result.state == "granted" || result.state == "prompt") {
// navigator.clipboard.writeText(this.responseText).then(function() {
// modal_window({ message: '<div class="alert alert-info">Package names has been copied to the clipboard.</div>', title: "Package names copied"});
// }, function() {
// modal_window({ message: '<div class="alert alert-warning">Error: Package names has not been copied to the clipboard.</div>', title: "Error with accessing the clipboard"});
// });
// } else {
// // ...
// }
// });
var TempVar = document.createElement("textarea");
document.body.appendChild(TempVar);
TempVar.innerHTML = this.responseText;
TempVar.select();
document.execCommand("copy");
document.body.removeChild(TempVar);
modal_window({ message: '<div class="alert alert-info">Package names has been copied to the clipboard.</div>', title: "Package names copied"});
}
};
xhttp.open("POST", "GetPackageNames.php", true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.send(query);
}
Re: Batch actions
Due to the fact that there is not a single way to implement clipboard-copy, I have done if the following way in one of my ASP.NET projects:
Hope this helps!
Regards,
Jan
- Show a modal dialog with a textarea
- Put the text into the textarea
- .focus() the textarea
- .select() the textarea, so the whole text will be selected
- There is a hint that user's should press [CTRL]+[C] now (or CMD+C)
- So user copies the text to the clipboard by using the well-known shortcut
- I'm listening for keystrokes and on keystroke of CTRL+C I close the modal dialog
Hope this helps!
Regards,
Jan
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
Re: Batch actions
Hi,
not sure what exactly you try to acheive, but maybe you can try:
not sure what exactly you try to acheive, but maybe you can try:
Code: Select all
var TempVar = document.createElement("textarea");
document.body.appendChild(TempVar);
TempVar.textcontent = this.responseText;
TempVar.focus();
TempVar.setSelectionRange(0, target.value.length);
document.execCommand("copy");
document.body.removeChild(TempVar);
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: Batch actions
@pböttcher: this will not work in all browsers, I'm afraid
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
Re: Batch actions
It would seem that the problem is all about security. It would work in all (or most) browsers, it if call my function from a click event.
The error message from Firefox ..
document.execCommand(‘cut’/‘copy’) was denied because it was not called from inside a short running user-generated event handler.
.. lead me to this page - kinda explaining the problem: https://developer.mozilla.org/en-US/doc ... _clipboard
This is going to be tricky to get around.
The error message from Firefox ..
document.execCommand(‘cut’/‘copy’) was denied because it was not called from inside a short running user-generated event handler.
.. lead me to this page - kinda explaining the problem: https://developer.mozilla.org/en-US/doc ... _clipboard
This is going to be tricky to get around.
Re: Batch actions
Hi,
maybe you explain a little bit in detail what you try to acheive, so there might be another solution.
maybe you explain a little bit in detail what you try to acheive, so there might be another solution.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: Batch actions
Hmm ... You can retrieve this content knowing the ids by using JavaScript code like this:
Code: Select all
var col6 = [];
for(var i = 0; i < ids.length; i++) {
col6.push($j('#tablename-fieldname-' + ids[i]).text());
}
AppGini plugins to add more power to your apps:
- DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
- Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
- Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.