Opened 10 years ago

Closed 10 years ago

#10069 closed enhancement (worksforme)

dojox.grid.cells.NumberTextBox will be nice to have

Reported by: Marcin Gołębski Owned by: Nathan Toone
Priority: high Milestone: 1.4
Component: DojoX Grid Version: 1.3.2
Keywords: DataGrid edit number Cc:
Blocked By: Blocking:

Description

It will be nice to have cellType which accepts only number, like dijit.form.NumberTextBox?

Attachments (2)

dojox.grid.tests.test_data_grid_edit_dijit.patch (806 bytes) - added by Marcin Gołębski 10 years ago.
test for NumberTextBox?
dojox.grid.cells.digit.patch (1.0 KB) - added by Marcin Gołębski 10 years ago.
patch which adds NumberTextBox?

Download all attachments as: .zip

Change History (15)

Changed 10 years ago by Marcin Gołębski

test for NumberTextBox?

comment:1 Changed 10 years ago by Adam Peller

Component: GeneralDojoX Grid
Owner: changed from anonymous to Nathan Toone

comment:2 Changed 10 years ago by Nathan Toone

Milestone: tbd1.5

Have you signed a cla?

comment:3 in reply to:  2 ; Changed 10 years ago by Marcin Gołębski

Replying to toonetown:

Have you signed a cla?

No, I haven't. How can I do this? The second question: why milestone 1.5 not trunk?

comment:4 in reply to:  3 ; Changed 10 years ago by Marcin Gołębski

Have you signed a cla?

No, I haven't. How can I do this?

OK, I know it. I will send it this weekend.

comment:5 in reply to:  3 Changed 10 years ago by Nathan Toone

Replying to mgolebsk:

why milestone 1.5 not trunk?

Since we don't have a CLA yet from you, you said you'll get it in this weekend, but we are cutting the 1.4 beta this weekend...and no new features will be going in. I can get it into the trunk as soon as we release 1.4 (thus it will be available for 1.5).

Even if the CLA were in now, I am a bit wary of adding any new features this close to a release...so the change would still be in for 1.5.

comment:6 Changed 10 years ago by haysmark

As the patch indicates, you can already do this with a _Widget cell+widgetClass=NumberTextBox? very compactly. You don't even need the get/setValue definitions because if you type something invalid, the NumberTextBox? just stays open.

comment:7 Changed 10 years ago by haysmark

For instance, we have a CurrencyTextBox? declared in a grid structure that is simply:

{
name: 'Amount',
field: 'col5',
formatter: formatCurrency,
constraint: {currency: 'EUR'},
widgetClass: dijit.form.CurrencyTextBox
},

It seems overkill to add a separate NumberTextBox? definition given that CurrencyTextBox? works fine without its own definition.

comment:8 in reply to:  6 Changed 10 years ago by Marcin Gołębski

Replying to haysmark:

As the patch indicates, you can already do this with a _Widget cell+widgetClass=NumberTextBox? very compactly. You don't even need the get/setValue definitions because if you type something invalid, the NumberTextBox? just stays open.

Two cases:

  1. when NumberTextBox? cell you enter character then widget stays open until it deletes
  2. when you enter out of ranges value and then pres enter - the new incorrect value will be send to the Store.

That's why get/setValue is necesary.

comment:9 in reply to:  7 Changed 10 years ago by Marcin Gołębski

Replying to haysmark: It does not work when you use pure html grid definition, eg:

<th field="minH" editable="true" widgetClass="dijit.form.NumberTextBox" constraint="{min:0, max:9999999}">Min H</th>

the efect is simple edit cell which accespts all character.

Changed 10 years ago by Marcin Gołębski

patch which adds NumberTextBox?

comment:10 Changed 10 years ago by haysmark

You're right, I looked at the source I pulled that from and what I posted was not the whole story. It turned out there was a defaultCell being set that was specifying type: dojox.grid.cells._Widget.

We have an example of creating such a cell in markup (although it is acting up ATM):

http://archive.dojotoolkit.org/nightly/checkout/dojox/grid/tests/robot/_DataGrid.html

If you look at the source for that page, the equivalent HTML to what I posted above, with the defaultCell flattened into the definition, is:

<th cellType="dojox.grid.cells._Widget" widgetClass="dijit.form.CurrencyTextBox" field="col5" formatter="formatCurrency" constraint="{currency:'EUR'}" editable="true" width="8em" styles='text-align: right;'>Amount</th>

I would encourage you to try it. For the problem number 2 you were describing, that sounds like a bug with Grid using RangeBoundTextBox?, which we should fix for all widgets, not just this one.

comment:11 in reply to:  4 Changed 10 years ago by Marcin Gołębski

Replying to mgolebsk:

Have you signed a cla?

I sent my cla on 28.10.2009.

comment:12 in reply to:  10 ; Changed 10 years ago by Marcin Gołębski

Replying to haysmark:

<th cellType="dojox.grid.cells._Widget" widgetClass="dijit.form.CurrencyTextBox" field="col5" formatter="formatCurrency" constraint="{currency:'EUR'}" editable="true" width="8em" styles='text-align: right;'>Amount</th>

I would encourage you to try it.

Yes, it works fine.

For the problem number 2 you were describing, that sounds like a bug with Grid using RangeBoundTextBox?, which we should fix for all widgets, not just this one.

Maybe we shoud create another ticket for this issue and close this one?

comment:13 in reply to:  12 Changed 10 years ago by Nathan Toone

Milestone: 1.51.4
Resolution: worksforme
Status: newclosed

Replying to mgolebsk:

Maybe we shoud create another ticket for this issue and close this one?

Yes - please open another ticket for that issue. I will close this one as worksforme since the original issue appears to be working now.

Note: See TracTickets for help on using tickets.