nuPicker JSON, I success get the data and I can see data in backofice but I have a problem.
I want to use nuPicker dropdown (or values) in Razor view but I have a problem (couldn't appear). So my idea is because I will use this as a composition to pick a value from that and save that value (may be blog post), and all blog posts will have a diff values picked from nuPicker, and I want to display full list of nuPicker JSON at view as I told before, and use some jQuery or something like this to filter.. (also I have try to show picked up value but no success).
Thanks Handy,
I'll try this later. Yes, the idea was in backoffice I will pick one value. But in razor view I want to show all values in dropdown as options and this will be some kind of filter. Ex. if in backoffice composition I select value from picker - TEST1 and save, and after that when I go to the razor page where will be the full picker (with all values) and I select TEST1 from the options I want to show the content that is matched.
Hi, your pickedItems variable is a nuPickers.Picker object, this has the method GetEditorDataItems() which will return all key/value pairs (not just the picked ones).
var picker = pickedItems; // (I can't see the alias for the GetPropertyValue)
foreach(var editorDataItem in picker.GetEditorDataItems())
{
var key = editorDataItem.Key;
var label = editorDataItem.Label;
}
nuPicker JSON on view
nuPicker JSON, I success get the data and I can see data in backofice but I have a problem. I want to use nuPicker dropdown (or values) in Razor view but I have a problem (couldn't appear). So my idea is because I will use this as a composition to pick a value from that and save that value (may be blog post), and all blog posts will have a diff values picked from nuPicker, and I want to display full list of nuPicker JSON at view as I told before, and use some jQuery or something like this to filter.. (also I have try to show picked up value but no success).
Can u show me the correc way ?
Hi, if I understand, you want to use all the key/values in the razor view, not just the picked ones ?
ModelsBuilder should return a nuPickers.Picker object, otherwise you should be able to do the following:
Then you can use this to get at the collections:
There's a wiki page about this Picker model. An example there shows the PickedKeys property, but there should probably be an AllKeys property too !
Thanks Handy, I'll try this later. Yes, the idea was in backoffice I will pick one value. But in razor view I want to show all values in dropdown as options and this will be some kind of filter. Ex. if in backoffice composition I select value from picker - TEST1 and save, and after that when I go to the razor page where will be the full picker (with all values) and I select TEST1 from the options I want to show the content that is matched.
This doesnt work for me :/
With this I can get the selected value from dropdown
@{ var pickedItems = Model.Content.GetPropertyValue
@foreach (var item in pickedItems.PickedKeys) { < li >@item< /li > }
}
and now only that is needed is how can I populate dropdown with all values from the pickerTest (not only selected)
Hi, your pickedItems variable is a nuPickers.Picker object, this has the method GetEditorDataItems() which will return all key/value pairs (not just the picked ones).
HTH, Hendy
@{ var pickedItems = Model.Content.GetPropertyValue
I don't know why alias does not appear here but the alias is test1Picker
and this is what I get
System.NullReferenceException: 'Object reference not set to an instance of an object.'
on picker.GetEditorDataItems()
Hi, what version of nuPickers are you using ? (this method was added in v1.6.0)
I'm using 1.7.0.
Can u writee full code (first for getting only selected which I have right now), and after that all values
is working on a reply...