74
Views
1
Comments
Datagrid and Javascript Linking to Action
Question

What I am trying to do is have a button in each row (tied to an ID), open an Modal that will edit the entry. I am close but I am having issues with the widgets that, according to this forum, are the only way to link a JS action to a "Screen Action" (like toggle a Modal). 


My two widgets are inputID, which is an Input type Widget and holds the value of the ID. Second is btnID ,that is the button used to trigger the Screen Action. 


So when both widgets are visible, everything works. Now when I make them not-visible, the debugger in my browser can't find an element with that name, making the function not work. 


I have a Data Grid with an Advanced Column, the column has the following content:

"sampleButtonColumn(GridOS.GridObject[GridOS.TemporaryVariables.arrPos].gridId, 
'" +JobPartIDCol.Id + "', 
'" + JSONFieldButton + "', 
'" + JobIDEditInput.Id + "',
'" + JobEditbtn.Id + "')"

My Main Screen has the following JS Code:

sampleButtonColumn = function(gridId, widgetId, fieldId,inputID,btnID) {
    if (fieldId !== '') {
        return '<input type="button" class="Button" onclick="TestFun($title,\'' + inputID + '\',\'' + btnID + '\')" style="height:20px" value="Edit: $title">';
    }
};
function TestFun (IN,inputID,btnID)
{
    document.getElementById(inputID).value = IN;
    document.getElementById(btnID).click();
}
2026-02-26 06-29-24
Rahul
 
MVP

Hi Bill,

I think you are using IF widget for hide visibilty it will be hide permanent no element will be created,

do one thinkg use css style for hide element 'display:none' and try your code it will work.


Hope this will help you.

Regards

Rahul

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.