- Wed Dec 07, 2016 4:01 pm
#787800
Hello,
I was trying to figure out how to limit the number of Grid Rows in PM 3.1.
I found this old thread and tried to modify the old code and test the second one posted.
viewtopic.php?f=7&t=2440
Old Code Modified:
I was trying to figure out how to limit the number of Grid Rows in PM 3.1.
I found this old thread and tried to modify the old code and test the second one posted.
viewtopic.php?f=7&t=2440
Old Code Modified:
Code: Select all
New Code Someone Posted there:
function gridMaxRowsAlert(){
alert("You've reached the maximum number of lines for this grid.");
}
function onAddNewRow(){
var MAXROWS = 2;
var totalRows = $("#gridVar002").getNumberRows();
if (totalRows >= MAXROWS){
$("#gridVar002").addRow=gridMaxRowsAlert;
return false;
}
return true;
}
$("#gridVar002").onAddRow=onAddNewRow;
Code: Select all
Neither of these seem to be working for me. Any thoughts on how to limit the number of grid rows added to a grid in a form for 3.1?$('#gridVar002').onAddRow(function(){
var MAXIMUMROWS=2;
var countOfRows=$('#gridVar002').getNumberRows();
if(countOfRows>MAXIMUMROWS)
{
alert("You have reached the maximum lines");
$('#gridVar002').deleteRow();
}
});