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
190
Get the column id
posted

Hi,

I have a webgrid where I put a checkbox in the column header. 

 

UltraGridColumn

 

 

testcol = e.Layout.Bands[1].Columns.FromKey("Test");

 

 

Then I hook the checkbox to a jvscript function.  The problem I'm having is that I don't how to pass the column header id to the function.  Can you help?

Thanks!

Parents
  • 45049
    Suggested Answer
    posted

    I recommend that you put information in the ID of the checkbox (or possibly in other attributes) so that you can determine what column the checkbox belongs to.  Then, you can define your function like this:

    function myFunction(sender) { ...}

    ... and call your function like this:

    <input type="checkbox" id="something" onclick="myFunction(this)" ... />

    If you already have other parameters to your function, add the "sender" parameter to the end, and make sure that you pass "this" as the value when you call it from the event.

    By passing "this" as a parameter to an event handler of an HTML element, you pass a reference to the HTML element that raised the event.  In this setup, you know that "sender" is the checkbox that raised the event.  You can then inspect properties such as "sender.id" to determine the column to which the checkbox belongs.

Reply Children
No Data