Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8114685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:13:19+00:00 2026-06-06T03:13:19+00:00

Here’s my DataGrid: // $ is a reference to `this` as it lies in

  • 0

Here’s my DataGrid:

// $ is a reference to `this` as it lies in an anonymous function
$.grid = new DataGrid({
    store : $.dataStore,
    query : {id : "*"},
    structure : [
        { 
            noscroll : true,
            cells : [{ name : "Recipe", field : 'name', width : '200px' }],
        },
        {
            cells : [
                [
                 { name : 'ID#', field : 'id', width : '50px'},
                 { name : 'Category', field : 'category', width : '100px'},
                 { name : 'Status', field : 'status', width : '100px'},
                 { name: "Actions", width : '200px', type: dojox.grid.cells._Widget, formatter : $._actionButtons}
                ]
            ] // end cells
        }
    ]
}, $.targetNode)
$.grid.startup();

$.grid.on("RowClick", function(e){
    console.log(this.getItem(e.rowIndex))
})

And my formatter object for the Actions cell:

_actionButtons : function(){
    var _self = this;
    var _args = arguments;
    this.group = new Pane()

    var full = new Button({ 
        label: 'View Full',
        style : { fontSize : '80%'},
        onClick : function(){
            try {
                _self.grid.onRowClick.apply(this, arguments)
            }catch(e){}
        }
    });
    full._destroyOnRemove = true;

    var edit = new Button({
        label : 'Edit',
        style : {fontSize: '80%'}
    });
    edit._destroyOnRemove = true;

    construct.place(full.domNode, this.group.containerNode)
    construct.place(edit.domNode, this.group.containerNode)

    return this.group;
}

I’m trying to get access to the event object that would be passed by a normal onRowClick event on the DataGrid. As it sits now this kinda works, but on the on("RowClick"...) block I get multiple logs. Without the try...catch block I get an error as the rowIndex doesn’t exist in e, then 2 more logs where it does exist.

This is the 4th or so idea I’ve had included pub/sub, emit(), etc. I have a feeling that the multiple logs are caused by the bubbling behavior (Button -> Row -> DataGrid or somesuch), but getting the onRowClick’s event object to get passed into the Buttons created in the formatter seems impossible.

I just want to access the rowIndex (and other DataGrid-esque properties) from the Button widget’s onClick event to process according to the button pressed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T03:13:23+00:00Added an answer on June 6, 2026 at 3:13 am

    Along the same lines, but here’s what I came up with that seems to be working in a direction where what I’m envisioning will happen. Adjusted cell where the buttons will be:

    { name: "Actions", width : '200px', type: dojox.grid.cells._Widget, formatter : 
        function(){
            return $._actionButtons.call($, arguments);
        }
    }
    

    Adjusted onClick function in the returned Button widget:

    _actionButtons : function(){
        var _index = arguments[0][1],
            _item  = this.grid.getItem(_index)
            _self  = this;
    
        // some code removed
    
        onClick : function(){
            console.log(_self.dataStore.getValue(_item, 'name'), "clicked")
        }
    }
    

    I’ll probably end up extending Button to handle this a bit better, but for now, voila!

    Sometimes it just helps to write it down and put it out there for your brain to panic and figure out the solution before anyone else does 🙂

    Minor update…

    There is the formatterScope parameter for the DataGrid, but it applies to all formatter‘s and would therefore mess up anything requiring cell scope and not DataGrid scope. The above method allows me to access everything I need.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

here is code: <script type=text/javascript> function doit(){ $('table td').each(function () { if ($(this).text().trim() !=
Here is the code I'm using inside my AsyncTask DefaultHttpClient httpClient = new DefaultHttpClient();
Here is an example. foreach (var doc in documents) { var processor = this.factory.Create();
Here's what I'm trying to accomplish with this program: a recursive method that checks
Here is the css: #content ul { font-size: 12px; } I am trying this:
Here's an example query: DECLARE @table table (loc varchar(10)) INSERT INTO @table VALUES ('134a'),
Here is my query: select word_id, count(sentence_id) from sentence_word group by word_id having count(sentence_id)
Here is my query: SELECT * FROM [GeoName] WHERE ((-26.3665122100029-Lat)*(-26.3665122100029-Lat))+((27.5978928658078-Long)*(27.5978928658078-Long)) < 0.005 ORDER BY
Here's a query that works fine: SELECT rowid as msg_rowid, a, b, c FROM
here's what we have today: * NxM grid of points in 3D * we

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.