In addition I am getting a warning about the addMenuItem:
The function addMenuItem(bootstrapextracomponents-navbar.menuItem) is not applicable for the arguments
({itemId:String,displayType:String,iconName:String,onAction:String,position:String,text:String})
it would be good to add this example or a similar one to the wiki if thats possible as the instructions made little sense to me, I don’t know about others
Hm. Not sure I understand why that isn’t clear. The docs state
Method
addMenuItem
Parameter (name/type)
menuItem:menuItem
Description
Adds the given menu item to the bar.
Meaning the method wants a menuItem (even a link to the type definition is available) and not an array of something. That would look like this:
so in this case, it wants an array containing menuItem items (it wants all items).
Examples in the Wiki would be nice, I agree. But they take time that I can’t spend on features And there is a sample solution that among other things has exactly your case as example.
I have copied this and added onAction as a function it is still not creating a menu item ? the code is:
I have done just that right now. Copied the code (except that I chose an ID not already used and used a different method) and put it in the sample solution on the “Add item” button:
Talking the need for annotation on board where do you get the correct syntax because I have tried adding this to another component and its throwing a warning “Unknown type servoyextracomponents-sidebar” ie is there a type list anywhere as I have not seen it ?
I have to investigate this a bit. It seems that the media type can’t be just set from a byte, maybe because we need a resource on the server (instead of the bytes).
As a workaround you could do
var media = solutionModel.newMedia('mylogo',record.image_media)
elements.navbar.brandLogo = 'media:///mylogo'
patrick:
I have to investigate this a bit. It seems that the media type can’t be just set from a byte, maybe because we need a resource on the server (instead of the bytes).
As a workaround you could do
var media = solutionModel.newMedia('mylogo',record.image_media)
elements.navbar.brandLogo = ‘media:///mylogo’
Bit strange, but it should work.
Hi Patrick,
thanks for looking in to this & I will have to use your ‘strange’ way of doing it for the moment.
Thanks
Rafi
As I thought: the media type does not support byte. I could add a property brandLogoDataprovider, then you could assign a form variable or something like that, but I think that’s a bit over engineered. Your use case of setting a nav bar’s brand logo from a record is maybe not the 90% use case…
patrick:
As I thought: the media type does not support byte. I could add a property brandLogoDataprovider, then you could assign a form variable or something like that, but I think that’s a bit over engineered. Your use case of setting a nav bar’s brand logo from a record is maybe not the 90% use case…
Hi.
My ‘use case’ is that I want a client to be able to associate an image of their choosing that I am now getting them to store along with their organisation details & then in solution, if they change the ‘org’ it changes the logo…
(My client has two parts that I have termed organisations and in the solution someone at a higher level may want to change which org they are dealing with & illustrate by changing logo)
I’d be happy with a new property brandLogoDataprovider…
patrick:
But since this logo is rather static, it doesn’t feel wrong to create a media from it, does it?
Most of them it will be static, but if the client decides to change the logo they use for an org, I don’t want to have to be changing media files on the server and I’m also using that table media on reports, so want it to come from the table …
Also, I’m a bit confused
In my onLoad I put
var media = solutionModel.newMedia('mylogo',_to_organisation_default.logo);
elements.navbar.brandLogo = 'media:///mylogo';
and that sets the correct image.
I have added a menu to the navbar with the list of organisations and an ‘onDataChange’ method to that menu.
Prior to this, this code changed the brandLogo correctly
// remove logo if it exists
var removed = solutionModel.removeMedia('mylogo');
// set logo to org logo
var media = solutionModel.newMedia('mylogo',_to_organisation_default.logo);
elements.navbar.brandLogo = 'media:///mylogo';
(followed by an application.updateUI…)
and the relationship which is based on a global is having it’s global value changed (& if I console output the media column, it changes), as the org name which is setting brandName is changing also based on that relationship??
Not sure what I’m doing wrong or why it isn’t working…
It could be that Servoy does not see the setting of brandLogo = ‘media:///logo’ as a change and therefore doesn’t send anything to the client.
Try something like this instead:
// set logo to org logo
var media = solutionModel.newMedia('logo_' + _to_organisation_default.organisation_id, _to_organisation_default.logo);
elements.navbar.brandLogo = 'media:///logo_' + _to_organisation_default.organisation_id;
This should give each org logo a unique name… (given that the ID of organisation is called “organisation_id”).
patrick:
It could be that Servoy does not see the setting of brandLogo = ‘media:///logo’ as a change and therefore doesn’t send anything to the client.
I think that must be the case…
patrick:
Try something like this instead:
This should give each org logo a unique name… (given that the ID of organisation is called “organisation_id”).
Also, with this approach, there is no need to remove any media previously created…
Hi,
I was just playing with the online demo (demo.servoy.com) & downloaded the bootstrapextracomponents sample from there, imported it & let it auto import the correct web packages, but the current release of Bootstrap Extra Components seems to be missing the ‘badges’ component??
Is there a reason or is it just a mistake?
Thanks
Rafi