Copied to clipboard

Flag this post as spam?

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


  • Yasir Butt 161 posts 371 karma points
    Dec 20, 2014 @ 23:28
    Yasir Butt
    0

    Custom control in grid - Umbraco 7.2

    Hi,

    I have some knowledge about how to create custom grid control but wondering that how to use already available umbraco data types/controls in grid?

    I want to use related links data type in grid. Any idea how?

    Yasir

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Dec 21, 2014 @ 03:50
  • Yasir Butt 161 posts 371 karma points
    Dec 21, 2014 @ 13:09
    Yasir Butt
    0

    Hi Dennis,

    Thanks for sharing these links. I had already went through these links and i know that how to build custom control for grid.

    but my concern/question is that is it possible to use already build data types in grid?

    Explanation:

    In Developer section i already have a datatype called Realted links and i want to use this one in grid.

    As i have limited knowledge so i can see 2 ways right now

    1. In grid.editors.config.js i add a new configuration for my control but in the view setting use umbraco property editor path e.g "view": "/umbraco/views/propertyeditors/realtedlinks/relatedlinks.html" Control is visible but not working as it should be. bang :)

    2. I have to create my own custom related links control in app_plugins same as which is already exist in umbraco build in property control. which is like same code twice at two different places.

    Hope you understand my problem.

    Yasir

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Dec 21, 2014 @ 23:23
    Jan Skovgaard
    0

    Hi Yasir

    If the control is visible but not working as intended have you then tried having a look in the browsers console log to see if it gives you any errors?

    /Jan

  • Yasir Butt 161 posts 371 karma points
    Jan 01, 2015 @ 23:33
    Yasir Butt
    0

    Hi Jan!

    Sorry for late reply. I was on vocations and out of country.

    My configuration for related links are

    { "name": "Related links", "alias": "relatedlinks", "view": "/umbraco/views/propertyeditors/relatedlinks/relatedlinks.html", "icon": "icon-coin", "render": "/Views/Partials/Grid/Editors/relatedlinks/render.cshtml" }

    Below is the related links image how it is rendered.

    enter image description here

    Here is the console output on edit and add

    TypeError: Cannot set property 'edit' of undefined at Object.$scope.edit (http://dev.norgesinvestor.no/DependencyHandler.axd?s=L3VtYnJhY28vbGliL2pxdW…bnMvdTdkdGcvdTdkdGcuY29udHJvbGxlci5qczs&t=Javascript&cdv=477677181:1417:29) at http://dev.norgesinvestor.no/DependencyHandler.axd?s=L3VtYnJhY28vbGliL2pxdW…bnMvdTdkdGcvdTdkdGcuY29udHJvbGxlci5qczs&t=Javascript&cdv=477677181:13:4671 at http://dev.norgesinvestor.no/DependencyHandler.axd?s=L3VtYnJhY28vbGliL2pxdW…pbnMvdTdkdGcvdTdkdGcuY29udHJvbGxlci5qczs&t=Javascript&cdv=477677181:75:112 at Object.e.$eval (http://dev.norgesinvestor.no/DependencyHandler.axd?s=L3VtYnJhY28vbGliL2pxdW…bnMvdTdkdGcvdTdkdGcuY29udHJvbGxlci5qczs&t=Javascript&cdv=477677181:14:7447) at Object.e.$apply (http://dev.norgesinvestor.no/DependencyHandler.axd?s=L3VtYnJhY28vbGliL2pxdW…bnMvdTdkdGcvdTdkdGcuY29udHJvbGxlci5qczs&t=Javascript&cdv=477677181:14:7554) at HTMLButtonElement.

    ON Add

    TypeError: undefined is not a function at Object.$scope.add (http://dev.norgesinvestor.no/DependencyHandler.axd?s=L3VtYnJhY28vbGliL2pxdW…nMvdTdkdGcvdTdkdGcuY29udHJvbGxlci5qczs&t=Javascript&cdv=477677181:1417:503) at http://dev.norgesinvestor.no/DependencyHandler.axd?s=L3VtYnJhY28vbGliL2pxdW…bnMvdTdkdGcvdTdkdGcuY29udHJvbGxlci5qczs&t=Javascript&cdv=477677181:13:4671 at http://dev.norgesinvestor.no/DependencyHandler.axd?s=L3VtYnJhY28vbGliL2pxdW…pbnMvdTdkdGcvdTdkdGcuY29udHJvbGxlci5qczs&t=Javascript&cdv=477677181:75:112 at Object.e.$eval (http://dev.norgesinvestor.no/DependencyHandler.axd?s=L3VtYnJhY28vbGliL2pxdW…bnMvdTdkdGcvdTdkdGcuY29udHJvbGxlci5qczs&t=Javascript&cdv=477677181:14:7447) at Object.e.$apply (http://dev.norgesinvestor.no/DependencyHandler.axd?s=L3VtYnJhY28vbGliL2pxdW…bnMvdTdkdGcvdTdkdGcuY29udHJvbGxlci5qczs&t=Javascript&cdv=477677181:14:7554) at HTMLButtonElement.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jan 07, 2015 @ 09:49
    Jan Skovgaard
    0

    Hi Yasir

    Sorry about the late reply, holiday and flu caught me.

    I'm wondering if you have set debug to be "true" in the web.config? Just search for "debug" and change it to "true" if it's set to false.

    This disables the backoffice cache, which can cause some errors since changes to your property editor is not being picked up etc.

    Hope this helps.

    /Jan

  • Yasir Butt 161 posts 371 karma points
    Jan 09, 2015 @ 15:44
    Yasir Butt
    0

    Hi,

    Somehow i managed to make working related links as a custom grid control and its working as it should be.

    Secret: I have copied related links code from umbraco to App_plugins directory and replace $scope.model to $scope.control. Its working perfect now.

    Now i am experienced another error it is becuase of grid handle which has delete and sort icon. some reason it width is 150px and it come over related links control and i cant click on add/delete button.

    See this image below. I dont know that it should call bug in grid or something else.

    enter image description here

    Css which is causing error

    .usky-grid .cell-tools { position: absolute; top: 0; right: 0; bottom: 0; z-index: 50; width: 150px; /* opacity: .3; */ -webkit-transition: all .2s ease-in-out; -moz-transition: all .2s ease-in-out; transition: all .2s ease-in-out; }

    Any one experience this kind of error?

    Yasir

  • Danny Leech 36 posts 114 karma points
    Jan 13, 2015 @ 18:56
    Danny Leech
    0

    Hi Yasir, I'm trying to do exactly the same with the media picker (I need an editor for selecting multiple media items) can you elaborate on how you got the related link picker to work?

    Thanks in advance

    Dan

  • Yasir Butt 161 posts 371 karma points
    Jan 14, 2015 @ 01:27
    Yasir Butt
    0

    Hi Dan,

    It is easy :)

    Code related to javascript of all umbraco property editors are inside the umbraco.controller.js file. You have to copy only code related to mediapicker. its controller name is Umbraco.PropertyEditors.MediaPickerController.

    Copy its js code and add it to your custom controller js file and change the name of the controller and replace the $scope.model with $scope.control at every place inside the controller

    Next is html. Copy the html from mediapicker.html and add it to your custom control's html file. and change the ng-controller name with your new name.

    Setup your package.manifest file like

    {
    //array of files we want to inject into the application on app_start
    javascript: [
    '~/App_Plugins/Multimedia/multimedia.controller.js'
    ]}
    

    Now you have to add configuration for your custom control in grid.editors.config.js. like

    {
        "name": "Multimedia",
        "alias": "multimedia",
        "view": "/app_plugins/multimedia/editor.html",
        "icon": "icon-coin",
        "render": "/Views/Partials/Grid/Editors/Multimedia.cshtml"
    }
    

    you have to create your grid editor render file in your grid editor folder or according to your path.

    Remove the cache and restart the app pool OR touch your web.config. so your are good to go. control should be visible and it should work as it supposed to be.

    These are the same instructions you can use to create any kind of umbraco property editor to custom grid control. I think so :) if there are any error so you have to rectify.

    any way i have created a multimedia picker for you. you can download it from here https://onedrive.live.com/redir?resid=150E960233041ECE!173&authkey=!AK5o5BvHLpZaT00&ithint=folder%2czip

    I have commented some code in js file. you can see my comments with my name in js file.

    Yasir

  • Yasir Butt 161 posts 371 karma points
    Jan 14, 2015 @ 01:30
    Yasir Butt
    0

    This multimedia is working for me see image below enter image description here

  • Danny Leech 36 posts 114 karma points
    Jan 15, 2015 @ 17:13
    Danny Leech
    0

    Hi Yasir, thank you very much for your comprehensive responsive! I've got it working mostly but I'm experiencing two issues... 1. The new custom editor doesn't appear in the list of editors when I create a new datatype although it is there in my original custom data type as I got this partly working before? Are you aware of a caching issue, I've cleared the Clientdendency cache and incremented the clientdependancy.config, restarted app etc but its stil not being shown. 2. In my original adta type all appears to work except the sorting - changes to the order are not being saved...

    Any thoughts?

    Many thanks again for your help, 

    Cheers,

    Danny

  • Yasir Butt 161 posts 371 karma points
    Jan 15, 2015 @ 17:27
    Yasir Butt
    0

    Hi Danny!

    1. If control does not appear in the list. I always remove the clientdepency folder from under App_Data/Temp folder. Refresh the browser and it should appear in the list. What do you mean by "it is there in my original custom data type"?

    2. What is your origianl data type?

    Jan said to me that "I'm wondering if you have set debug to be "true" in the web.config? Just search for "debug" and change it to "true" if it's set to false." Try this one as well

    Yasir

  • Danny Leech 36 posts 114 karma points
    Jan 15, 2015 @ 17:33
    Danny Leech
    0

    Hi Yasir, I got this half working before I'd seen your post.... Its was chnging the scope from model to control that was the break through. The custom editor appeared in the list but it gave an error when I tried to use it.

    Implement your solution everything apart from the sorting works but it no longer appears in the list of available editors when I create a new data type.

    Does that make sense?

    Cheers,

    Danny

  • Yasir Butt 161 posts 371 karma points
    Jan 15, 2015 @ 18:06
    Yasir Butt
    0

    Hi,

    Yes i checked it carefully and you are right, sorting is working but when we save then it get back to older postion.

    Right now i have no idea. I will check it later and come back to you.

    Yasir

  • Danny Leech 36 posts 114 karma points
    Jan 15, 2015 @ 18:26
    Danny Leech
    0

    Hi Yasir, it appearing again now... I think there must be some very heavy caching going on somewhere.... as even resetting Safari didn't fix it but its there now!! I notice this post talks about the same caching issue with no resolution.

    http://our.umbraco.org/forum/umbraco-7/using-umbraco-7/56496-Custom-editors-in-grid-(Umbraco-72)?p=1

    Anyway... just the sorting to fix. If I discover anything I'll let you know but thank you soo much for your help so far!

    Cheers,

    Danny 

  • Yasir Butt 161 posts 371 karma points
    Jan 15, 2015 @ 22:44
    Yasir Butt
    0

    Hi Danny!

    I looked the sorting problem and it looks like that it is bug in Multimedia picker.

    I tried on another document type as normal data type. I added multiple images, sorted them and did save and publish then refresh the page then sort order got back to older order.

    I debug it and There is function seupViewModel which is calling a function entityResource.getByIds(ids, "Media") which creates the problem and return the different order

    You may check it!

    Yasir

  • Danny Leech 36 posts 114 karma points
    Jan 16, 2015 @ 08:47
    Danny Leech
    0

    Hi Yasir,

    Thanks again for your speady research! Looks like its a bug in the media picker. I've added a standard media picker to a doc type and enabled multi selections and it too is not saving the order after save and publish. I see you have raised this as a bug too! Thanks again

    Danny

  • Ben McKean 272 posts 549 karma points
    May 15, 2015 @ 11:58
    Ben McKean
    0

    Hi

    Just a follow up on this, I manged to get this working another way using LeBlender which can use any of the built in datatypes. The only issues was Related Links datatype didn't look great on the right hand side so I replaced it with Multi Url Picker as recommended on this post https://our.umbraco.org/projects/backoffice-extensions/leblender/bug-reports/64515-Related-links-Grid-editor

    Just thought I'd post as it was a fairly quick alternative.

  • yogesh pathak 136 posts 221 karma points
    Jun 01, 2015 @ 11:49
    yogesh pathak
    0

    Hi all,

    I am trying to create a grid editor which accept a collection of headlines and text corresponding to it ,can anyone please explain where to specify js file? and how to create renderer?

    thanks

    Yogesh

Please Sign in or register to post replies

Write your reply to:

Draft