Looking at the extjs4 documentation for the itemselector, theres a method getValue() that returns the valueField on an array, i would like to know if there is a method that gets the displayField of the value.
Thanks again
There is no such thing. You would need to write your own, or look up item by it's value and get displayField from it. Considering your last question I think you really need to extend standard ItemSelector and have your own ItemSelectorEx.
Related
I'm trying to add objects (simple key-value pairs) to a list.
However, the v-model is still bound to the previously added objects, so if I add "ObjectOne" vith "ValueOne", then try to add "ObjectTwo" with "ValueTwo", "ObjectOne" gets edited AND "ObjectTwo" gets added.
I am by no mean an expert in Javascript, so it might not be related to VueJS.
I can obviously make this work with a method per list .
The point is that my model has multiple lists of key value pair to be edited, so I tried making a generic method :
addToList: function(value, list){
console.log("Adding " + value + " to list "+list);
list.push(value);
value={};
},
This method works if used on "simple" lists (like an array of string), but not on "objects" list.
My guess is that as I try to clean "value" instead of "this.value", the reference still points to the same object, but since I don't know what "value" will be when called, I don't know how to do this.
Here is the fiddle with a re-creation of my issue.
My objective would be to be able to use the "addToList" function to add to any list, without having to re-write a function for each list.
Thank you for your help.
The above behaviour is because you are updating the value of same object whenever you add a new todo task.You need to set your object again to add new values as below.
addToList(value, todos){
this.todos.push(value);
this.anotherTodo={ text:'',
done:'false'}
}
Working fiddle here.
I post this as an answer, but if someone has a better way to do it, I'm all hear.
I solved the way by adding a watch on my list. When the list changes, I clean the model object that's added to it.
In my production work, I had to add a computed property, since I can't add a watch on an object's property, then a watch on said computed property :
watch:{
todos(){
this.anotherTodo={};
},
fiddle as demo
I have grid with columns with get method (an optional function that, given a data item, will return the value to render in the cell). I want to use values of this function for sorting purpose. What is the right way to do that?
No, It is not possible. The sorting is done on the data in Store/Collection. whereas, the get method is related to the particular column of the grid and is called while rendering. Sorting is done before the rendering of grid.
You probably would want to add a new property to the data/store with the values in the get function. apply sort on that property.
What about if we just want to look at what's there rather wanting to change stuff and then we want to access it by it's key rather than using dot notation?
For example:
I have object called CatalogData
I can do CatalogData.Images to get the pages.
However, say I have a function that return NSManagedObject and I want to pass #"Images" to that function.
So, eventually it'll get something like
[anNSManagedObjectThatisactuallyaCatalogData orderdSetforKey:#"Images"]
Well, we can't have that.
So why?
Should we use the good old objectForKey?
You can just use
[anNSManagedObjectThatisactuallyaCatalogData valueForKey:#"Images"]
which returns an NSOrderedSet if "Images" is an ordered to-many relationship.
I have a ListView bound to an ObjectDataSource, I'm passing some custom parameters to the Insert and Update methods on my bound class methods by adding them to the event.Values map in the ListView ItemInserting/ItemUpdating events.
However when I try to do the same thing on the ItemDeletingEvent the additional parameters do not seem to be passed to the datasource ( If I register a listener for ObjectDataSource.ItemSourceDeleting I only see one parameter, effectively the 'id' of the row).
Is this an expected behavior? I can't see anything in the documentation that indicates as such.
I found a solution -
I Added a 'DeleteParameter' value with the same name as my desired 'custom' parameter to the ObjectDataSource declaration.
Then in the ItemDeleting Event get the ObjectDataSource.DeleteParameters["myparam"] and set the DefaultValue property. Seems like a hack, but it does work.
How to name a method that does getting and removal from the collection?
Say we have a collection Fruits. To get apples we would do something like apples = Fruits.Get("apples"). To remove - Fruits.Remove("apples"). If we want to do both in one method it would return apples and remove them form the collection. Something like apples = Fruits.Take("apples"). Any better ideas than "Take"?
Either remove() or take() are fine.
For example:
In java.util.Map, the remove() method gets and removes an object specified by a key.
In JavaSpaces, the take*() methods get and remove and object specified by a template.
pop(index) seems a reasonable misuse of stack's method to me.
Somewhat language specific but something like:
Object remove(int index)