Ribbon button disabled after programmatically adding to SharePoint 2010 Ribbon - ribbon

I followed this link to create custom ribbon tab/group/controls in a custom web part.
The custom ribbon tab/group/control renders when web part is displayed on the page, however, all the buttons are disabled.
What I did:
During OnLoad event, initialized List of IRibbonCommand with all my button command id; initialized page component and registered with SPRibbonScriptManager; registered ribbon scripts for getglobalCommands, commandEnabled, and handleCommand.
During OnPreRender event, use SPRibbon to load XML and RegisterDataExtension for the whole structures; use SPRibbon to MakeTabAvailable and set InitialTabId.
PageComponent script has been registered and initialized properly. Tab/Group/Control are displayed but buttons are disabled and the info indicates 'the control is currently disabled'. I am the site administrator and have full permission so security is not a problem.
Any idea?

I fixed the problem: it is important to register all commands with script manager before running page component initialization code via script.

Related

Hiding a ribbon button when specific Dynamics CRM Web Resource is in context

Like most of dynamics crm programmers know, we can add "web resources that are not associated with any entity" to the sitemap. If such a customization is made, when user clicks that link, web resource will be opened and the buttons in the application ribbon will be added to the ribbon section of the dynamics crm.
What I am wondering is if there is any way I can hide this global buttons that are in the application ribbon based on the web resource on the page.
Let's say I added more than one web resources to my sitemap, namely a.htm and b.htm. Let's say I have a custom button named x in the application ribbon. Right now x is displayed both for a.htm and b.htm, but in reality I would like to hide the button when user clicks on b.htm from the sitemap.
Is there a way to accomplish that?
You could use the following (unsupported) code to hide the Ribbon button (the 'Run Workflow' button in this example):
var btnRunWorklfow=top.document.getElementById("account|NoRelationship|Form|Mscrm.Form.account.RunWorkflow-Large");
btnRunWorklfow.style.display='none';
You can also use ribbon editor available in codeplex to disable your button based on your javascript.
Refer to: http://crmvisualribbonedit.codeplex.com/
I figured there is no supported way of doing this.

Back Key doesn't terminate the app and doesn't back to mai page

I'm working in a Windows Phone 8.1 Project and have created it from a WP blank page (XAML and C#). After that added a new blank page and I navigate from main page through a blank page using a button. Now I'm struggling to navigate between pages.
If I'm at main page and press the physical back key button of my cellphone, my app doesn't terminate, instead it goes to background.
If I'm at blank page and press the physical back key button of my cellphone, my app doesn't go back to main page, instead it goes to background.
I have tried several methods from internet (most of them using silverlight which is not my case) but I didn't understand how to create an event handler to deal with that.
Navigation doesn't work in 8.1 because it isn't built in by default as it was in 8.0. You either have to do it yourself or instead of using a new Blank Page use a Basic Page.
The first time you add a Basic Page to your project the IDE will automagically add all the stuff to do automatic back page navigation. It will add a new NavigationHelper class under the Common directory. It will also add NavigationHelper methods to the page where you can add code for recreating the page after a terminate and resume.

Access 2010 Web Database OpenForm Action

I am designing a web database using Access 2010
I have put a macro which uses the openform action
The Window Mode for this Action is "Dialog". in the dropdown this is the only option which is available for this setting.
when the form opens up, i can see that it is very small and its size is fixed.
I want to set the initial size of the form, or atleast make it resizeable so that uses can enter data properly in the newly opened form
I had the same problem, but found this:
http://books.google.co.uk/books?id=G78tE7JjgDcC&pg=PA775&lpg=PA775&dq=access+2010+macro+set+window%2Bmode&source=bl&ots=bvmf2qN0fL&sig=gcAysal_0g1jJ3gOJP2c5WGVbKE&hl=en&sa=X&ei=yMkeUI-KJaWG0AXNu4GoAw&ved=0CE0Q6AEwADgK#v=onepage&q=access%202010%20macro%20set%20window%2Bmode&f=false
(bottom of page 775)
Shows that Access 2010 macros are web based and only open forms in dialogue mode, not tabbed mode as in access. This does not show any other way around the problem! But I'm still looking.

Chromium pass message to popup extension even if it is not active

I am developing a chrome extension. I am able to pass a message from background page to popup extension when a context menu is clicked if i open the popup page with "Inspect pop-up" selection. Because it stays open in this way.
But if I click the context menu when the popup page is not opened, no message received by it.
Do you have any suggestions to open popup automatically, make it stay open or send message to it when even if it is not active.
There is no way to pragmatically open a popup window. Popup windows are only active when the popup is open which is why you cant send messages to it when it is closed.
You could either queue messages in the background page and have them retrieved the next time the popup window is opened. Or depending on the functionality you might look into using HTML5 desktop notifications instead.
Instead of sending stuff to the popup, the popup should request what it needs when it is opened.
Because the popup is just an HTML page, it doesn't exist until it has been opened.
Basically, like abraham mentioned, you would store any information in the background, using localStorage or chrome.storage. When the popup opens, it should then use the chrome.extension.getBackgroundPage() function to get a reference to the background, which can provide access to the stored information.
If you are using localStorage or chrome.storage, you may be able to access it directly, without using the background, as storage is shared across the whole extension.

Primefaces - using dialogs and layouts

I have a (JSF 2.0/ Primefaces 2.2RC-SNAPSHOT) app that has
<p:layout>
I use a lot of dialog in my application and before the newest version of primefaces came out there was no way to display a dialog with a modal on top of the layout without putting the dialogs outside of the tags.
So I did just that. The issue I am having now is I am noticing that constructors and postcontructs are being called when my application is loaded. This is because the view with the layout is being loaded and therefore all my dialogs are being loaded.
I don't want these constructors being called until I am actually dealing with the appropriate views in my application.
I have been testing the appendToBody attribute on the
<p:dialog>
tag but it seems really buggy. Everything works fine on the initial rendering of a view. I can open a dialog close it etc and it works fine. If I navigate away to another view and then come back to the initial view and open the dialog, everything is running off the page. The dialog window is in the correct place but the content is not.
My question is 1. Is there a way I can have the dialog windows outside of my layout as a child of the
<h:body>
without having all the managed bean constructors associated with them initiated when the application loads?
Or does anyone know how to fix the alignment issue when using the appendToBody tag? Thanks.
When using layout and dialog, I usually place my dialogs outside of the layout as a direct child of the body element. I have a special ui:insert part in my page template for this.
appendToBody was added to make this easier, if it doesn't work well for you, give this approach a try. I know modal dialogs and layout can work this way.
without having all the managed bean constructors associated with them
initiated when the application loads
Maybe the managedbean gets loaded when your dialog is rendered.
Try rendering the dialog only after the button click, perhaps byputting rendered="#{mybean.flagLoadMyDialog}" on the dialog, and set the flagLoadMyDialog when the button is clicked using ajax.
Also remember to ajax-update the dialog after the button click.