This topic is locked

Inline Add rows on demand

1/17/2024 2:04:26 AM
PHPRunner Tips and Tricks
S
stiven author

Hello,

Lets say you use the inline add on the list page quite often to add multiple rows. For example if you are constantly adding 5-10 new rows using inline add option you have to click the inline button 5-10 times.

Here I'll show you how you can have the user input how many rows they want to add to the list page.

On the list page click on Insert Text and you want to add an input field with a button.

<input type="number" class="form-control" id="num-rows" style="display: inline-block;width: 50%;margin: 0 7px;"> <a href="#" class="btn btn-primary" id="add-custom-rows" style="display: inline-block;">ADD ROWS</a>

It will look something like this

img alt

Then on the list page on the Javascript onLoad event you add the following code that will add the amount of rows entered by the user. I limit the amount to 20

$("#add-custom-rows").click(function(e){

e.preventDefault();
var num = $("#num-rows").val();
if(num > 1)
{
if(num > 20)
num = 20;

for(var i=1; i<=num; i++)
{
pageObj.inlineAdd.inlineAdd();
}
}else{
pageObj.inlineAdd.inlineAdd();
}

});
acacio.rapaz@fastdata.pt 1/24/2024

Good afternoon, thank you for this tip.
But if I need to create 10/20 ROWS and in each of them put the customer number that I already chose above but didn't record, is it possible?

img alt