Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderator: amosbatto

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.
#823989
I don't have a mobile device to test this, but try using standard JavaScript to add the options to the dropdown in a grid.
Code: Select all
//options to add to grid dropdown:
var newOpts = [
   ["value1", "label1"],
   ["value2", "label2"],
   ["value3", "label3"]
];
var gridId = "myGrid";  //set to ID of grid
var dropdownId = "myDropdown"; //set to ID of dropdown inside grid

var nRows = $("#"+gridId).getNumberRows();

for (var i = 1; i <= nRows; i++) {
   var oDropdown = document.getElementById("form["+gridId+"]["+i+"]["+dropdownId+"]");
   
  for (var ii = 0; ii < newOpts.length; ii++) {
     var opt = document.createElement('option');
     opt.value = newOpts[ii][0];
     opt.text = newOpts[ii][1];
     oDropdown.add(opt, 0);
   }
}

$("#"+gridId).onAddRow( function(aNewRow, oGrid, rowIndex) {
  var oDropdown = document.getElementById("form["+gridId+"]["+rowIndex+"]["+dropdownId+"]");
   
  for (var ii = 0; ii < newOpts.length; ii++) {
     var opt = document.createElement('option');
     opt.value = newOpts[ii][0];
     opt.text = newOpts[ii][1];
     oDropdown.add(opt, 0);
   }
});
#823990
PS: Please don't post the same question multiple times. It makes it confusing for me and anyone searching for answers. I get to questions in my free time, so you need to be patient.
If you need answers quickly, then you should pay for a support contract with ProcessMaker Inc.
#824022
Does it work if you change onAddRow() to onShowRowDialog()?
Code: Select all
var env = PMDynaform.getEnvironment();

//if using the mobile app:
if (env == "android" || env == "iOS") {
  $("#"+gridId).onShowRowDialog( function(row, gridObject, rowIndex, rowModel) {
    var oDropdown = document.getElementById("form["+gridId+"]["+rowIndex+"]["+dropdownId+"]");
   
    for (var ii = 0; ii < newOpts.length; ii++) {
      var opt = document.createElement('option');
      opt.value = newOpts[ii][0];
      opt.text = newOpts[ii][1];
      oDropdown.add(opt, 0);
    }
  });
}
else { //if using a web browser:
  $("#"+gridId).onAddRow( function(aNewRow, oGrid, rowIndex) {
    var oDropdown = document.getElementById("form["+gridId+"]["+rowIndex+"]["+dropdownId+"]");
   
    for (var ii = 0; ii < newOpts.length; ii++) {
      var opt = document.createElement('option');
      opt.value = newOpts[ii][0];
      opt.text = newOpts[ii][1];
      oDropdown.add(opt, 0);
    }
  });
}
#824027
That's the thing, I need to fill the dropdown field on load, without tapping on the grid and waiting for a module to pop up.
.onShowRowDialog is an action that triggers a module to pop up with all the row properties.
I need to fill the dropdown when form loads.
By enesa11
#824032
takipçi al instagram ve sosyal medya almaya devam et! Kaliteli, güvenilir ve gerçek hesaplarla takip edilir. Beğendikler, yorumlar, aboneler, görüntüleme, görüntüleme hizmetleri. Youtube, twitter, facebook, instagramın tepesinde kalın.
pdf preview in processmker

Hi, You must create a panel in your form, then cre[…]

claim multiple unassigned case

Hi, I have created "User Friendly Panel"[…]

Stop download file on click of link

Hi, You can this link for get download url: https[…]

i want to check the checkbox on certain condition.[…]