Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
835
Minor issue with template for an individual column
posted

So in my grid, I have this key column called entityName. And below, inside my TEMPLATE definition, I define an Html button with an onClick() event.

However, it does NOT fire my onClick() event for column entityName (string type) - yet it does indeed fire when I change it to column Margin (number type).

And btw, it renders the ${entityName} value inside the value attribute in my Html <input> markup...however I can't pass it to my onClick() event.

Could someone please tell me what I'm missing here ? This is really a strange one.

Thank you everybody in advance....Bob

ex/

   $("#accountsGrid").igGrid({
            autoGenerateColumns: false,
            width: null,           // will stretch to fit data
            caption: "Accounts for: " + member,
            dataSource: jsonData,
            primaryKey: "entityName",
            columns: [
                { headerText: "Account", key: "entityName" , dataType: "string"  },
                { headerText: "Margin", key: "Margin", dataType: "number", format: "double"  },
                { headerText: "Liquidity Interval (Days)", key: "LookbackInterval", dataType: "number", format: "number" },
                { headerText: "Confidence Level", key: "ConfidenceInterval", dataType: "number", format: "percent" },
                {
                    headerText: "Trades", unbound: false, key: "tradesBtn",                     
                    template: "<input type='button' value='View trades for ${entityName}' onClick='buttonTest(event, ${entityName});' /> "
                }                
            ],
            rowTemplate:null

       cellClick: function (evt, ui) { GetTradesByAccount(evt, ui); }
        });

    function buttonTest(e, buttonId) {        
        alert("BUTTON CLICKED for " + buttonId);
        e.cancelBubble = true;
    }

Parents
No Data
Reply
  • 5105
    Suggested Answer
    Offline posted

    Hi there,

    Surround your ${entityName} with quotes "${entityName}" because it's a string I assume and it's going to be treated as a global variable without the quotes.

    Thank you for using the Infragistics forums!

Children