Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • John French 32 posts 83 karma points
    Apr 09, 2015 @ 02:47
    John French
    0

    nuPickers.JsonDropDownPicker question

    Hi everyone,

    Just doing my first umbaco 7 project and want to use the new nuPickers.JsonDropDownPicker.

    I have set it up to call ~/umbraco/Surface/DataTypeSurface/GetProductFilters

    This succesfully calls my function

     

     [HttpGet]
            [NotChildAction]
            public JsonResult GetProductFilters()
            {
                var Items = new List();

                Items.Add(new SelectListItem { Text = umbraco.library.GetDictionaryItem("value.default"), Value = "" });
                Items.Add(new SelectListItem { Text = umbraco.library.GetDictionaryItem("value.price"), Value = "price" });

                return Json(Items);
            }
    
    
    

     

    but nothing is returned in the dropdown in the document where I have placed  this datatype.  Can't seem to find any documentation on what format the Json needs to be in or a good example of how this works, has anyone succesfully used this datatype in umbraco 7 and can give me some quick pointers?

    thanks

     

     

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Apr 09, 2015 @ 07:55
    Dave Woestenborghs
    101

    I think you need to allow a get request to your action when you are returning json.

    return Json(Items, JsonRequestBehavior.AllowGet)

    Dave

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Apr 09, 2015 @ 10:32
    Hendy Racher
    1

    Hi James,

    Do you have the following for your data-type configuration ?

    • Url: ~/umbraco/Surface/DataTypeSurface/GetProductFilters
    • JSONPath: $..*
    • Key JSONPath: Value
    • Label JSONPath: Text
    Just tried your surface controller method with Dave's fix and all seems to be working...
    (Hoping to find some time soon to update the nuPicker GitHub wiki documentation)
    Hendy
  • John French 32 posts 83 karma points
    Apr 10, 2015 @ 02:33
    John French
    0

    @Dave - yes that was it! thanks..

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies