Bootstrap Extra Components 1.1.0 released

Announcements of the latest WebComponents for NGClient (shipped by the WebPackageManager)

Re: Bootstrap Extra Components 1.1.0 released

Postby rafig » Fri Jun 23, 2017 10:02 am

patrick wrote: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...

Thanks
Rafi
Servoy Certified Developer
Image
rafig
 
Posts: 489
Joined: Mon Dec 22, 2003 12:58 pm
Location: Watford, UK

Re: Bootstrap Extra Components 1.1.0 released

Postby patrick » Fri Jun 23, 2017 1:34 pm

But since this logo is rather static, it doesn't feel wrong to create a media from it, does it?
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3622
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: Bootstrap Extra Components 1.1.0 released

Postby rafig » Fri Jun 23, 2017 1:46 pm

patrick wrote: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
Code: Select all
   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
Code: Select all
   switch (_to_organisation_default.name, 1)) {
   case 'Org2':
      elements.navbar.brandLogo = "media:///Org2Logo.png";
      break
   default:
      elements.navbar.brandLogo = "media:///OrgDefaultLogo.png";
   }

but now using this code, it doesn't work
Code: Select all
   // 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...
Servoy Certified Developer
Image
rafig
 
Posts: 489
Joined: Mon Dec 22, 2003 12:58 pm
Location: Watford, UK

Re: Bootstrap Extra Components 1.1.0 released

Postby patrick » Fri Jun 23, 2017 2:03 pm

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:

Code: Select all
// 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 Ruhsert
Servoy DACH
patrick
 
Posts: 3622
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: Bootstrap Extra Components 1.1.0 released

Postby patrick » Fri Jun 23, 2017 2:03 pm

Also, with this approach, there is no need to remove any media previously created...
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3622
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: Bootstrap Extra Components 1.1.0 released

Postby rafig » Fri Jun 23, 2017 2:47 pm

patrick wrote: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 wrote: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...

as it now works great, thanks for the suggestion.
Servoy Certified Developer
Image
rafig
 
Posts: 489
Joined: Mon Dec 22, 2003 12:58 pm
Location: Watford, UK

Previous

Return to Web Components

Who is online

Users browsing this forum: No registered users and 1 guest

cron