Page 1 of 1

How to a access grid row, field on mobile!!!!!!!!

Posted: Tue Apr 09, 2019 10:41 am
by kalinovski
How to a access grid's row, field on mobile without grid.onShowRowDialog()
I'm trying dynamically to populate a dropdown with options when form loads, but I can't access the field's object.

Re: How to a access grid row, field on mobile!!!!!!!!

Posted: Wed Apr 10, 2019 1:39 pm
by amosbatto
It is better to use a trigger to populate the list of options in dropdown boxes, by setting its datasource to "array variable" and setting its data variable to the name of the variable.
See: https://wiki.processmaker.com/3.2/DynaF ... Datasource

If you really need to use JavaScript, then see:
https://www.pmusers.com/index.php/Chang ... rid_fields

Re: How to a access grid row, field on mobile!!!!!!!!

Posted: Thu Apr 11, 2019 3:16 am
by kalinovski
That method doesn't work with mobile grids.
getFieldById(gridId).gridtable[dropdownColNo].model.mergeRemoteOptions(aNewOptions);

.gridtable is empty.

Re: How to a access grid row, field on mobile!!!!!!!!

Posted: Mon Apr 15, 2019 9:26 pm
by amosbatto
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);
   }
});

Re: How to a access grid row, field on mobile!!!!!!!!

Posted: Mon Apr 15, 2019 9:30 pm
by amosbatto
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.

Re: How to a access grid row, field on mobile!!!!!!!!

Posted: Tue Apr 16, 2019 4:05 am
by kalinovski
var oDropdown = document.getElementById("form["+gridId+"]["+rowIndex+"]["+dropdownId+"]");
oDropdown.add(opt, 0);

It doesn't work on mobile.

Re: How to a access grid row, field on mobile!!!!!!!!

Posted: Tue Apr 16, 2019 8:58 pm
by amosbatto
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);
    }
  });
}

Re: How to a access grid row, field on mobile!!!!!!!!

Posted: Wed Apr 17, 2019 2:43 am
by kalinovski
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.

instagram takipçi

Posted: Wed Apr 17, 2019 7:17 am
by enesa11
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.