PDA

View Full Version : Ext.ux.data.TextFieldStore



RouslanZenetl
23 Feb 2009, 2:08 PM
Demo

http://www.jadacosta.es/extjs/examples/textfieldstore/

About

Subclass of Ext.data.Store that uses a regular text field (usually Ext.form.TextField or Ext.form.TextArea) to store data.

Just like any Ext.data.Store can feed to/from Grid, ComboBox or DataView.

Naturally TextFieldStore inherits all the standard Store functionality such as sorting, filtering, traversing, etc.

In this example EditorGrid is showing milestnes, feeding data from a TextArea field. Such field would usually be hidden, but for the purposes of this example, its left visible.

There a combo field in the toolbar which feeds from the same store, and so adding row to the grid also adds a choice to the ComboBox.

Options

fieldId : String
id or name of data TextField. Usually either a Ext.form.TextField or Ext.form.TextArea

formPanelId : String
id of FormPanel that contains data TextField

recordDelimiter : String
String (usually a signle character) used as record delimiter. Default ; (semicolon)

fieldDelimiter : String
String (usually a signle character) used as field delimiter. Default ~ (tilde).


Source Code

See attachment below:

RouslanZenetl
23 Feb 2009, 2:11 PM
an important note: this should be considered early beta, use at your own risk ~o)

jsakalos
23 Feb 2009, 3:31 PM
Could you explain a use case of this extension?

RouslanZenetl
23 Feb 2009, 3:52 PM
This is a very common scenario with Lotus Notes.

A document might have a multi-value field with, say, invoice line items. Or history of edits. Or workflow/approval chain. Quite often system requirements call for a limited (at least finite) number of such items. Perhaps less than few dozen. When that happens, an editable grid with TextFieldStore would do the job quite nicely.

But even beyond Lotus Notes I can easily see places where one might want to store semi-structured information into a text field yet show it on the form in a "civilized" Ext fashion.

I'll prepare a demo shortly to illustrate how coupling of TextFieldStore and a grid works.

jsakalos
23 Feb 2009, 4:01 PM
I'm looking forward to demo...

wki01
24 Feb 2009, 9:27 AM
I'm looking forward to demo...


As a domino programmer, I am very interested in this plugin.
I'm waiting with interest for a demo.

RouslanZenetl
24 Feb 2009, 11:40 AM
Here's an example of a Grid and a ComboBox feeding off of the same TextFieldStore.

To try it out, simply unzip into a folder, then open index.html

If anyone would volunteer to host this example, please do so and post a link here.

Enjoy!
z

galdaka
24 Feb 2009, 12:55 PM
Live example in http://www.jadacosta.es/extjs/examples/textfieldstore/

Good work!!

jsakalos
24 Feb 2009, 1:17 PM
galdaka, thanks for hosting of the example, now I finally know what it does.

I'm still trying to figure out a use case. Could somebody explain what would be a situation when I would want to store data in a (hidden) textfield? Should the storage to be non-volatile I need to store it in a database anyway, needn't I?

galdaka
24 Feb 2009, 1:32 PM
galdaka, thanks for hosting of the example, now I finally know what it does.

I'm still trying to figure out a use case. Could somebody explain what would be a situation when I would want to store data in a (hidden) textfield? Should the storage to be non-volatile I need to store it in a database anyway, needn't I?

Is specially useful for lotus notes / domino developments. In this enviroment exits "multiple values" fields by default. And with this store you can load automatically this fields in to a comboboxes or grids. Always theses fields are finite and / or short entries.

Greetings,

RouslanZenetl
24 Feb 2009, 1:39 PM
thank you, galdaka, for hosting this example.

also, please unzip the resources/* folder and return this line in index.html head:


<link rel="stylesheet" type="text/css" href="./resources/silk/silk.css" />

this will bring back toolbar button icons.

thanks!
z

RouslanZenetl
24 Feb 2009, 1:59 PM
galdaka, thanks for hosting of the example, now I finally know what it does.

I'm still trying to figure out a use case. Could somebody explain what would be a situation when I would want to store data in a (hidden) textfield? Should the storage to be non-volatile I need to store it in a database anyway, needn't I?

As part of the form hidden field data would ultimately be sent to the server, of course. Until then yes, it is volatile, much like the contents of a dialog box.

One way to think of this store is it's a poor man's transaction mechanism. You might want to let the user add/remove entries to the grid at will without having to touch your back end database, and then on form save (probably on the server side) parse records and update the database, or, in fact, simply stick the data into a text field (relational normalization gods forgive me :">)

jsakalos
24 Feb 2009, 2:36 PM
I use similar mechanism for data that have "an unpredictable" structure. Imagine, you have always firstName, lastName and then bunch of "preferences" you cannot say what they will be in the future. What I do in such cases is that I store json encoded object with data in one plain table text field and encode/decode it to have a "structure".

RouslanZenetl
24 Feb 2009, 3:10 PM
Exactly, except in this case data is taken from/placed into a text field right on the form. And its a data.Store, which also has its perks.