Opened 11 years ago

Closed 7 years ago

#6753 closed enhancement (fixed)

FilteringSelect: way of adding new items

Reported by: guest Owned by: haysmark
Priority: high Milestone: 1.7
Component: Dijit - Form Version: 1.1.0
Keywords: Cc: alex, bill, Adam Peller
Blocked By: Blocking:

Description (last modified by bill)

I defined a FilteringSelect dijit in html (using option tags instead of a datastore.). I've discovered that it is not possible to add a new item to the filtering select after it has been parsed.

Something like dijit.byId('id').addItem(name, value) really needs to be added.

At the very least there needs to be a way to add an item to the underlying default datastore.

Change History (14)

comment:1 Changed 11 years ago by Adam Peller

Cc: bill Adam Peller added; wildbill removed

comment:2 Changed 11 years ago by Adam Peller

see #6029

comment:3 Changed 11 years ago by bill

Milestone: 1.3
Owner: set to nathan
Summary: FilteringSelect has no way of adding new itemsFilteringSelect: way of adding new items
Type: defectenhancement

This boils down to implementing dojo.data.api.Write in dijit.form._ComboBoxDataStore (which would add requested feature for both ComboBox and FilteringSelect.

comment:4 Changed 11 years ago by Nathan Toone

Owner: changed from nathan to Nathan Toone

comment:5 Changed 11 years ago by bill

Milestone: 1.31.4

bumping 1.4 tickets to 1.5, and most 1.3 tickets to 1.4

comment:6 Changed 10 years ago by Nathan Toone

Milestone: 1.4future

comment:7 Changed 9 years ago by Nathan Toone

Owner: Nathan Toone deleted

Unassigning my tickets.

comment:8 Changed 9 years ago by haysmark

Owner: set to haysmark

I'll look at this. We have to implement:

  • newItem
  • deleteItem
  • setValue
  • setValues
  • unsetAttribute
  • save
  • revert
  • isDirty

The items are option tags, so newItem would expect at least the attributes "value" and "innerHTML". newItem would also mark new items as dirty. setValues would throw "feature not implemented." save would mark everything as clean and call both _saveEverything and _saveCustom like ItemFileWriteStore?. revert would throw out dirty items. isDirty would check for the dirt attribute. I think we can get away with a sufficiently small implementation that it won't severely impact the performance of existing users.

comment:9 Changed 9 years ago by haysmark

Are we going to have the new data api for 1.6? If so, maybe it would make more sense to implement adding new items using that api?

comment:10 Changed 9 years ago by bill

That's the plan, to have the new api in 1.6, so I agree it would make sense to follow that API.

comment:11 Changed 8 years ago by bill

I've got #12373 assigned to me for FilteringSelect to point to the new store API. (Feel free to grab it if you can get to it before me; it should be in 1.7 in either case.)

comment:12 Changed 8 years ago by bill

Component: DijitDijit - Form

comment:13 in reply to:  description Changed 7 years ago by zuzusik

Replying to guest:

I defined a FilteringSelect? dijit in html (using option tags instead of a datastore.). I've discovered that it is not possible to add a new item to the filtering select after it has been parsed.

Something like dijit.byId('id').addItem(name, value) really needs to be added.

At the very least there needs to be a way to add an item to the underlying default datastore.

This could be done in next way:

var a = dijit.byNode(yourWidgetNode);
dojo.place('<option value="new">New Option</option>', a.store.root, 'last'); //adding
dojo.destroy(dojo.query('[value="' + valueToRemove + '"]', a.store.root)[0]); //removing

a.store.root - simple html select with options and filtering select watches it.

comment:14 Changed 7 years ago by bill

Description: modified (diff)
Milestone: future1.7
Resolution: fixed
Status: newclosed

Isn't this working already? dijit/form/DataList, the class used internally for inline <option> tags, extends dojo/store/Memory, so you should be able to add data to it, via myFilteringSelect.store.put(...).

I'll close this but if I misunderstood something you can reopen.

Note: See TracTickets for help on using tickets.