Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#11035 closed enhancement (wontfix)

FilteringSelect nested fields

Reported by: Fausto Lemos Owned by:
Priority: high Milestone: tbd
Component: Dijit - Form Version: 1.4.0
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

Hello!

i´m using a FilteringSelect and try to set my "searchAttr" with a nested field present on a JSON string. An error occurred and then i debug and see that "labelFunc()" doesn´t expect this situation. So a make a quick customization and want to share with you guys to discuss if its possible to put this enhancement at the next release:

labelFunc: function(_33,_34){
             if (this.searchAttr.indexOf(".") != -1) {
	         return dojo.getObject(this.searchAttr,false,_33.i).toString(); 
             }
            else
	        return _34.getValue(_33,this.searchAttr).toString();
}

Change History (5)

comment:1 Changed 9 years ago by bill

Description: modified (diff)
Resolution: wontfix
Status: newclosed

Thanks for the idea. You must be using JsonRestStore? There's no concept of nested fields in dojo.data.

It's good that you found a way to do this for your case (which is probably a common case), and it's definitely OK to override that labelFunc method.

But, I don't want to add that code to FilteringSelect because FilteringSelect (like all the dijit widgets) is data-store agnostic, so it needs to work against any store, for which the official interface is:

store.getValue(item, this.searchAttr)

(And, that's what the current code is doing.)

comment:2 in reply to:  1 Changed 9 years ago by Fausto Lemos

Replying to bill:

Thanks for the idea. You must be using JsonRestStore? There's no concept of nested fields in dojo.data.

It's good that you found a way to do this for your case (which is probably a common case), and it's definitely OK to override that labelFunc method.

But, I don't want to add that code to FilteringSelect because FilteringSelect (like all the dijit widgets) is data-store agnostic, so it needs to work against any store, for which the official interface is:

store.getValue(item, this.searchAttr)

(And, that's what the current code is doing.)

Hello Bill,

i´m using a ItemFileReadStore?. It´s a interesting feature to allow nested fields at "searchAttr". Can we talk about a alternative way?

comment:3 Changed 9 years ago by bill

Well, maybe an alternative is to enhance the store so that this works:

store.getValue(item, "foo.bar.zaz")

In that case Tree doesn't need to know that it's a "nested field".

comment:4 Changed 9 years ago by Fausto Lemos

nice! it will be great!

comment:5 Changed 8 years ago by bill

Component: DijitDijit - Form
Note: See TracTickets for help on using tickets.