Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
By GianYagami
#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:
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
});
Want to create your own meme coin?

In the world of cryptocurrencies, a unique and exc[…]

The market for cryptocurrencies is demonstrating a[…]

What's SAP FICO?

Embarking on a dissertation can be one of the most[…]

Hello. For rental housing, there are software solu[…]