Today I’m going to hide the Save/Cancel/OK/Discard buttons in a LightSwitch HTML screen. Why? Because it’s really cool.
On any screen, select the “Write code” button and find the “activated” event (I’m sure this is still on the planning, but the CTP4, which is the current version, only has a “created” event; However you can tap into the post_render method of the last control on your screen as a workaround) and type:
myapp.Home.SomeControlInMyHomeScreen_postRender = function (element, contentItem) { $("[data-ls-tap='tap:{data.shell.discardCommand.command}']").hide(); $("[data-ls-tap='tap:{data.shell.saveCommand.command}']").hide(); $("[data-ls-tap='tap:{data.shell.okCommand.command}']").hide(); $("[data-ls-tap='tap:{data.shell.cancelCommand.command}']").hide(); };
The code uses a simple JQuery selector to find whatever HTML element has been rendered with a discard, save, ok or cancel command “attached to it” (the LightSwitch way), then uses the JQuery hide() method.
Bam, just like that.
The code shows some interesting details about the way the LightSwitch HTML client attaches commands to an HTML element, once I understand any of it I’ll make sure to share 🙂
Keep rocking LS!
Pingback: LightSwitch Community & Content Rollup–March 2013 - Beth Massi - Sharing the goodness - Site Home - MSDN Blogs
Is it possible to change the logo dinacally?
Hey Roberto
It probably is, I suspect the logo is simple CSS styling anyways. Will have a look later, see what I can do
Keep rocking LS!
Jan
You rock! I have been looking for a way to manipulate the save and discard icons in my LS html client.
Thanks!
Mark
Hi
Thanks , that way i can add event handlers to the click events also.
Thanks! Nice approach 🙂