- Tue Mar 17, 2020 4:23 am
#827745
Hi,
I've tried to make javascript which is dump every textinput. this grid acts as viewer instead of manual input.
I've tested the grid by hardcoding value to simulate the grid has a value.
if the grid is empty, I want to hide subform and delete all rows, this is frustating because by default, the grid is ready to fill with empty 1 column. My code is:
I've tried to make javascript which is dump every textinput. this grid acts as viewer instead of manual input.
I've tested the grid by hardcoding value to simulate the grid has a value.
if the grid is empty, I want to hide subform and delete all rows, this is frustating because by default, the grid is ready to fill with empty 1 column. My code is:
Code: Select all
$("#dyn_forward").hide();
var remarks = $('#1582424765e5792442e33b4075111111').find('#grid_rem_approvalsheet').getValue();
var aData = [
{value: "Sarah Means"}, //textbox
{value: "1" }, //checkbox is "1" or "0"
{value: "2015-10-25" }
];
$('#1582424765e5792442e33b4075111111').find('#grid_rem_approvalsheet').addRow(aData);
function checkRemarksGrid(item,index){
let columnEmpty = 0;
item.forEach(function(item, index){
if(item == '' || item == null){
columnEmpty++;
}
});
if(columnEmpty == item.length){
//check if all column empty, then hide subform "1582424765e5792442e33b4075111111"
//$('#1582424765e5792442e33b4075111111').hide();
$('#1582424765e5792442e33b4075111111').find('#grid_rem_approvalsheet').deleteRow(index);
}
}
$(document).ready(function(){
//check if has no remarks, then hide subform "1582424765e5792442e33b4075111111"
//checkRemarksGrid(remarks[0]); //just check first row, we don't need to check the rest
//remarks.forEach(checkRemarksGrid); //I just changed my mind, I want to delete if there's empty row. leaving it blank 'no data" instead of empty 1 row
});