I am trying to open the dialogService.linkPicker with pre-populated values (editing a link) on a custom Sir Trevor block. So far I have (below) which does open the link picker window but is there a way to pass in prevalues? I have tried 'options' and 'dialogData' but no joy. Any thoughts?
Cheers
...
var uDialogService = ngi.get("dialogService"); uDialogService.linkPicker({callback: block.onLinkSelected });
You would need to examine the source code; and it may be that you will need to implement the desired functionality yourself - what you could do is take a copy of the relevant controller and views and then edit that in your own plugin - I've been able to augment the interface using this approach quite succesfully.
You'll probably find that pre-populating the values will be reasonably straightforward - pass the list through as a property on the options object, for example, then use your custom picker with the dialog service.
So the currentTarget in dialogData is the set to the same object as target used in the view for the dialog that is send back out of the dialog. So inspect that object when you pick a link and see what properties & types of values you need to send in if you want to pre-populate this dialog.
DialogService LinkPicker - Populate Values
Hi,
I am trying to open the dialogService.linkPicker with pre-populated values (editing a link) on a custom Sir Trevor block. So far I have (below) which does open the link picker window but is there a way to pass in prevalues? I have tried 'options' and 'dialogData' but no joy. Any thoughts?
Cheers
...
You would need to examine the source code; and it may be that you will need to implement the desired functionality yourself - what you could do is take a copy of the relevant controller and views and then edit that in your own plugin - I've been able to augment the interface using this approach quite succesfully.
You'll probably find that pre-populating the values will be reasonably straightforward - pass the list through as a property on the options object, for example, then use your custom picker with the dialog service.
Hope this helps :)
Rob.
Did you get anywhere with this I'm trying to do a similar thing. Thanks
Hello Kenny,
Looks like you were on the right direction with dialogData.
But this
dialogData
needs an object calledcurrentTarget
See this line in the source code for reference:
https://github.com/umbraco/Umbraco-CMS/blob/dev-v7/src/Umbraco.Web.UI.Client/src/views/common/dialogs/linkpicker.controller.js#L21
So the
currentTarget
indialogData
is the set to the same object astarget
used in the view for the dialog that is send back out of the dialog. So inspect that object when you pick a link and see what properties & types of values you need to send in if you want to pre-populate this dialog.https://github.com/umbraco/Umbraco-CMS/blob/dev-v7/src/Umbraco.Web.UI.Client/src/views/common/dialogs/linkpicker.html
I hope this makes sense & is useful.
Cheers,
Warren
is working on a reply...