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 8187691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:38:49+00:00 2026-06-07T02:38:49+00:00

I have placed a textbox widget inside grid cell by using formatter. However, I

  • 0

I have placed a textbox widget inside grid cell by using formatter. However, I cannot move my cursor around nor select text inside the textbox.

E.g.
http://jsfiddle.net/g33m9/69/

Does anyone know how to fix this?

Thanks

  • 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-07T02:38:51+00:00Added an answer on June 7, 2026 at 2:38 am

    You need to set the column as ‘editable’ so that the Grid component will know how to handle keypressed events. So a modification to the layout is in order

    from

    var layout = [[
            {name: 'Column 1', field: 'col1'},
            {name: 'Column 2', field: 'col2', width:'200px', formatter: func}
        ]]; 
    

    to

    var layout = [[
            {name: 'Column 1', field: 'col1'},
            {name: 'Column 2', field: 'col2', width:'200px', formatter: func, editable: true}
        ]]; 
    

    Edit state activates by doubleclick.

    Now, OP wants it to be a fully bloated widget, popping up in the editable state. For this to be scaleable up with any number of rows/columns i will restrict this to the edit state, so that the value simply shows text but once double-clicked it will pop a FilteringSelect. Same principle goes with the dijit widget ValidationTextBox.

    Currently (1.7.2) the possible celltypes are:
    dojox.grid.cells.Bool
    dojox.grid.cells.ComboBox
    dojox.grid.cells.DateTextBox
    dojox.grid.cells.Select

    Catch me SEO:

    example of custom dojox.grid cellType widget – semi-programmatic

    First step – create some data

    var i = 0,
    data = {
        identifier: 'id',
        items: [
          { id: i, value: 'val'+i++},
          { id: i, value: 'val'+i++},
          { id: i, value: 'val'+i++},
          { id: i, value: 'val'+i++}
        ]
    },
    // The item label which holds visible value and which holds the value to represent
    searchAttr = 'value',
    valueAttr = data.identifier,
    // The store to use for select widget
    store = new dojo.data.ItemFileReadStore({ data: data }),
    // And the options, reassembling the valid options we will present in dropdown
    // Used when cellType is dojox.grid.cells.Select to name the allowable options
    options = [];
    dojo.forEach(data.items, function(it) { options.push(it[searchAttr])});
    

    Tricky part – Define a cellType

    Lets extend the existing dojox.grid.cells.Cell, it has two key features – an edit-state-formatter and the default-formatter. The default would work just fine. Last but not least, we’ll override the ‘_finish’ function allthough allow the Cell to process its own definition too.

    var whenIdle = function( /*inContext, inMethod, args ...*/ ) {
        setTimeout(dojo.hitch.apply(dojo, arguments), 0);
    };
    
    var FilteringSelectCell = declare("dojox.grid.cells.FilteringSelect", [dojox.grid.cells.Cell], {
        options: null,
        values: null,
    
        _destroyOnRemove: true,
        constructor: function(inCell){
            this.values = this.values || this.options;
        },
    
        selectMarkupFactory: function(cellData, rowIndex) {
            var h = ['<select data-dojo-type="dijit.form.FilteringSelect" id="deleteme' + rowIndex + '" name="foo">'];
            for (var i = 0, o, v;
            ((o = this.options[i]) !== undefined) && ((v = this.values[i]) !== undefined); i++) {
                v = v.replace ? v.replace(/&/g, '&amp;').replace(/</g, '&lt;') : v;
                o = o.replace ? o.replace(/&/g, '&amp;').replace(/</g, '&lt;') : o;
                h.push("<option", (cellData == v ? ' selected' : ''), ' value="' + v + '"', ">", o, "</option>");
            }
            h.push('</select>');
            return h;
        },
        textMarkupFactory: function(cellData, rowIndex) {
            return ['<input class="dojoxGridInput" id="deleteme' + rowIndex + '" data-dojo-type="dijit.form.ValidationTextBox" type="text" value="' + cellData + '">']
    
        },
        // @override
        formatEditing: function(cellData, rowIndex) {
    
            this.needFormatNode(cellData, rowIndex);
            var h = (cellData == "W1")
                ? this.textMarkupFactory(cellData, rowIndex)
                : this.selectMarkupFactory(cellData, rowIndex);
            // a slight hack here, i had no time to figure out when the html would actually be inserted to the '<td>' so.. Use 'debugger' statement and track function to hook into
            whenIdle(function() {
                dojo.parser.parse(dojo.byId('deleteme' + rowIndex).parentNode);
                var w = dijit.byId('deleteme' + rowIndex);
                w.focus()
    
            });
            return h.join('');
        },
        // clean up avoiding multiple widget definitions 'hanging'
        _finish: function(inRowIndex) {
            this.inherited(arguments)
            dijit.byId('deleteme' + inRowIndex).destroy();
        },
        // needed to read the value properly, will work with either variant
        getValue: function(rowIndex) {
            var n = this.getEditNode(rowIndex);
            n = dijit.getEnclosingWidget(n);
            return n.get("value");
        }
    });
    

    Last bit, a new layout

    var layout = [[
          { name: 'Column 1', field: 'col1' },
          { name: 'Column 2', field: 'col2', 
            cellType: FilteringSelectCell, options: options, editable: true
          }
    ]];
    

    Running sample here http://jsfiddle.net/dgbxw/1/

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

Sidebar

Related Questions

I have a TextBox control placed inside my window and I would like to
We have an AutoCompleteExtender linked to a TextBox. Both controls are placed inside an
I am using Ajax tab container control with 3 tabs. I have placed a
I have the control placed in DataGrid like this: <Label Name=lblDescription HorizontalAlignment=Left Margin=0,5,0,0 Grid.Row=2
I have placed 3 movieclips named mcParent, mcChild1, mcChild2 and 1 textbox in flash.
I have placed one textbox.... I want to put restriction on it .. that
I have a wpf Usercontrol, inside i am using a Winforms pdfviewer to display
I have a textbox used to search for products. This textbox is placed in
I have a text box like this <TextBox x:Name=SA1 Grid.Row=1 Grid.Column=1 TextAlignment=Center/> I need
i have a textBox(txtSearch) placed in a DataGridColumnHeadertemplate like this: <UserControl.Resources> <Style x:Key=DataGridColumnHeaderStyle1 TargetType={x:Type

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.