1
0
-1

Hi!

I have a gridForm its Id is : 'liste_coordonnes', with 3 columns : 'numero_borne', 'x', 'y'.

I want to fill it with Data via Javascript  like that :

-----------------------------------------------------

//Getting the grid

var mygrid = FormUtil.getField("liste_coordonnees");

//Construct the JSON object that correspond to the item row's form

var mydata = {"numero_borne":"1", "x":"Medical", "y":"Mediacal2"};

//Calling the formGrid add methd

mygrid(mydata);

---------------------------------

but it doesn't work, any help please

 

 

 

    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      I just have a try, quite easy to do with following script in form grid.

      function updateCell(fieldid, cellid, value, rowNo) {
          var element = FormUtil.getField(fieldid); 
          var row = $(element).find("tr.grid-row:eq("+(rowNo-1)+")"); //0-based
          var data = $(row).find("textarea").val();
          if (data !== "") {
              data = eval("["+data+"]")[0];
          } else {
              data = {};
          }
          data[cellid] = value;
          $(element).enterpriseformgrid("fillValue", element, row, JSON.stringify(data));
      }
      updateCell("grid1", "cell1", "test", 2); //row 2
        CommentAdd your comment...
      1.  
        1
        0
        -1

        Hi, I found this Add a new Row in Form Grid using script may be what you are looking for. Also, there is another sample app in How to do an auto calculation of grid 2 based on values from grid 1 ?  quite similar to your need but it is using advanced grid. There is another sample which is using load binder in How to populate Grid using the Bean Shell Load Binder?

          CommentAdd your comment...