How to select a dojo TabBarButton? - select

i have a view called divChal. When i change the view to that i also want to change the selected Button in the tabbar to the button with the id tabBarButtonChal.
i tried it like this, which doesn't work.
var divChal = dijit.registry.byId("divChal");
dojo.aspect.after(divChal,"onBeforeTransitionIn", function(){
var tabBarButtonChal = dijit.registry.byId("tabBarButtonChal");
tabBarButtonChal.select();
});
greets Tom

This way to set a property on a node is to evoke set(property, value) on it:
dojo.aspect.after(divChal,"onBeforeTransitionIn", function(){
dijit.registry.byId("tabBarButtonChal").set('selected', true);
});

Related

How can we add scroll event to sap.m.semantic.FullscreenPage?

I used the following code to add a scroll event to sap.m.semantic.FullscreenPage instance but was not successful.
var oPage = this.byId("__fullscreen_page_worklist");
oPage.attachBrowserEvent("window.onscroll", function(oEvent) {
console.log(oEvent);
});
While for sap.m.page it works. What must be change?

valueHelpRequest method not get fired in sap.m.input by enabling showValueHelp="true"

I want to show password by clicking help indicator in control sap.m.input.
As per code valueHelpRequest method must fired but not fired when clicking help indicator.
Its working fine for me. Share some code.
jsbin sample
js view code
createContent: function(oController) {
// button text is bound to Model, "press" action is bound to Controller's event handler
return new sap.m.Input({text:'{/actionName}',press:oController.doSomething,showSuggestion:true,showValueHelp:true,valueHelpRequest:oController.onVHR});
}
I got solution :
var oInput = this.getView().byId("idName"); oInput.attachValueHelpRequest(function(){
console.log("You click on value helper.")
});

How can I set the owner component a view?

If I create a view and its controller in run time how can I connect it to a component while when I call getOwnerComponent it returns the component.
I can not found any setOwnerComponent for the controller or view.
You can do this by running the code that creates the new view inside a "runAsOwner" call:
var oView = oComponent.runAsOwner(function() {
return sap.ui.xmlview("myView", {
// view info
});
});
You can see more information about the runAsOwner function here. I have also made a small fiddle to demonstrate this: https://jsfiddle.net/93mx0yvt/21/.

Issue with document.ready function in jQuery

I am having one issue with document.ready jQuery function.
On load the document.ready function is working fine. When I click on the button or href link, I want to reconnect with the document.ready function where I have set of code in JavaScript file.
Here is the actual scenario. Please find below sample JS code:
$(document).ready(function() {
var title = "This is your title";
var shortText = jQuery.trim(title).substring(0, 10).split(" ").slice(0, -1).join(" ") + "...";
alert(shortText );
});
After clicking submit button i am adding the input fields data in the below table row. In which description texts are also added in one of table row columns. If description field has more than 100 character, I am pushing the above mentioned JavaScript code from external .JS file. How can i refresh the Java script function without refreshing the page? Anyone have idea?
Please share your opinion.
Create a function, that you can call both in document.ready, and also anywhere else, such as a buttons click event:
function myfunc(){
var title = "This is your title";
var shortText = jQuery.trim(title).substring(0, 10).split(" ").slice(0, -1).join(" ") + "...";
alert(shortText );
}
$(document).ready(function() {
//call when document is ready
myfunc();
//call again when button is clicked
$('#button').click(myfunc());
});

call action methods in #Html.RadioButtonFor in MVC3

I have 3 radio buttons and 2 text boxes in a view. Initially I need to save the values in DB through the view and once its saved I need to display the saved values in the particular view according to which radio button I clicked.
One way is to post the values to a controller method, save it, then render back a new view with the values.
This got solved. We can use JQuery to achive tgis
View
--------
var url = '#Url.Action("YourActionName", "YourControllerName")';
$.post(url, 'ID=' + radio button Id , function (data) {
$('#txtBox1').val(data.Key1);
$('#txtBox2').val(data.Key2);
$('#txtBox3').val(data.Key3);
}
Controller
----------
Inside your action method , construct a JSON string as showed below and send back to JQuery Function.
var dataTest = new { "Key1"= "value1","Key2"= "value2", "Key3"= "value3" };
return Json(dataTest, JsonRequestBehavior.AllowGet);