Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

207
Visualizações
Use global variable in json - javascript - aggrid

I'm trying write a function which opens new tab refering to a linked source.

For that I need to send a payload with the id and other parameter which I already have in my grid table (field: "globalId" and field: "id").

I tried to execute the command to get the value, but I'm not able to use variables in the payload load as i get "{x}" as a result, is there any way to retrieve this from the already generated grid table?.

This is the part of the code I'm having issues with:

var x = formData.get().root.id;
  
 function openApplication() {
    var postData = {
            "action": "openApplication",
            "payload": {
                        "id": "x",
                        "caseId": "a75659c-36f315678299515",
                        "name": "test"
}
};

Here is the full code (which has the columns that need to retrieve the values from):

<script type="text/javascript" charset="utf-8">

 function DataFromAPI()
        {
    var url=basepath + '/rest?limit=20&offset=0&q=type:CAS+state:open+ModelId:eq:jlbc421f00f2f+name:eq:'+formData.get().root.name;
    httpClient.get(url, function (result) {
        gridOptions.api.setRowData(result);
      tempData.set('AsearchResult'.result);
      });
        }
   var columnDefs = [
            { 
          field: "Date", 
          headerName : "Date",  
          editable: false,
          resizable: true,
            }
        { 
          field: "id", 
          headerName : "",  
          resizable: true

        },
        { 
          field: "globalId", 
          headerName : "",  
          resizable: true

        }
        ];

  function getData() {
        const rowData1 = [];
        return rowData1;
        }
  
  // let the grid know which columns and what data to use
    const gridOptions = {
                columnDefs: columnDefs,
                onRowClicked: event => openApplication(),
                  defaultColDef: {
                    editable: true,
                    rowSelection: 'single',

                    filter: true,
                    sortable: true,
                    flex: 1,
                    minWidth: 100,
                    animateRows: true,
                    }
                };
    const eGridDiv = document.querySelector('#MeetingGrid');
    new agGrid.Grid(eGridDiv, gridOptions);
  DataFromAPI();
  
var x = formData.get().root.id;
     function openApplication() {
        var postData = {
                "action": "openApplication",
                "payload": {
                            "id": "x",
                            "caseId": "a75659c-36f315678299515",
                            "name": "test"
    }
    };

  
</script>
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda