Does Dojo has Label property for checkBox or its widgets? - dojo

I am creating a CheckBox in dojo as shown below-
new CheckBox({
id:"chckBox",
checked: true,
label: "Save for future"
},"divId").startup();
The checkBox has no label when it is displayed. It just has the checkbox checked.
So my question is - Do I need to have 2 separate components to be laid out, one for checkBox and other one for the label ?? Can't I just combine this into 1 widget?
Isn't there something similar to ExtJS where you have the fieldLabel property in dojo as well?
As well, say there is the no other way to create the check box with the label, other than having to input fields, then say if I need to do dynamic show/hide, do I need to apply CSS property on both the widgets separately,right ?
Please let me know if I am wrong.
Thanks !

Yes, you are all right.
There is no "checkbox with label" widget in DOJO, you need to create them separately and style them separately as well.

Related

Mixing radio and checkbox in a Dynatree

I´d like to create a tree mixing radio and checkbox .... The first section will use radio (to select just one Base layer in my map) and the others sections will use checkbox (to select any layers to show up)
Is it posible to do that with dynatree? Image attached...
Checkboxes and Radioboxes are simply CSS styled <span> tags, so you can add your own CSS that overrides this based on some custom node classes.
You should then use selectMode: 2, and implement the desired behavior in the onSelect handler.

Dojo Tooltip with multiple labels

I am new in Dojo and trying to find some features availability in Dojo. Please let me know if we can have multiple labels in Dojo tooltip widget.
I'm not sure exactly what you mean by multiple labels. The Tooltip label is used as an innerHTML, so it can contain HTML. I've used a inside of a label. Maybe you can use a list or other tags.
Also, you can change the Tooltip's label programmatically with:
myToolTip.set("label", "My New Label");

Sencha touch list with index bar : auto scroll

I'm starting in sencha touch ,and I try to create an application.only,I have a problem. I use a list with indexbar. this list is in a panel. and I wonder if it's possible to add an event listener to the panel, to jump to an index to the next. Let me explain with an example:
-We have a list of products and these products are sorted by their type (phones,computers...), the indexbar lets you know what type of product it is.
-To switch from one type to another,We Have to scroll.
What I seek to do is put a listener to the panel so that the scroll from one type to another is automatic every time you tap on the panel or on a next button. for example.
Please excuse my english and help
Thank you.
Try using dom property scrollTop .
For example:
el.dom.scrollTop = 1000;//this will push the panel down by 1000px;
You can always get the el, dom from panel/element properties/ attributes list.

Dojo : show() and hide() .... HOW?

I have a container element in which I create on the fly/place() a form, then another one..etc.
My goal is to switch between them i.e. hide all and show only the active form.
It hides alright, but I can't show the active back.
I tried using:
.style.display(none<->block) and visibility(visibility<->hidden)
dojo.style(...)
resize() and startup() after the changes
Several other variants i found on Internet from old dojo's
Nothing works.
/I need it to work with display, so that it does not occupy space./
Can you tell me what is the correct way to show and hide with dojo()
Also looked at this one :
How do I dynamically show and hide an entire TabContainer using DOJO?
Does not work.
The pseudo code I use is something like this :
....
//find or create the FORM element
form = dijit.byId(...);
if(typeof form != 'object') {
form = dojo.create('form', ....);
dojo.place(form,'containerx','last');
}
//hide all
dojo.query('#containerx > *').forEach(function(item){
dojo.style(item, 'visibility','hidden');// and all other variants i mentioned
})
//show only the current form
dojo.style(form, 'visibility','visible');
//if the dojo form obj was already created, then skip it
if (this.form_obj) return;
....build the form and the elements....
this.form_obj.startup()
thanx
I just answered the question in that thread you referenced in your question a few minutes ago. Basically it involved getting jQuery involved. Works great for me. I have all the tabs created statically (as opposed to programatically) and I'm able to manipulate whether they are shown or hidden with the help on jQuery. All the code any everything is in my post here:
How do I dynamically show and hide an entire TabContainer using DOJO?
Sounds like you might be looking for StackContainer functionality.
Just set things up so that the StackContainer has the dijit.form.Forms as children and you can use the selectChild method to choose what form to display.

attaching Tooltip to item without fixed element 'id'

I'm trying to add tooltips to a Dojo application that I recently inherited. The problem I'm having is that everything is created with dojoAttachPoint identifiers instead of with id's , such as :
so, I can't use "connectId= " when defining the tooltip, until I get a hold of the element's id that I want to connect to. Basically my question is, how can I find the id based on the dojoAttachPoint?
Thanks much for any suggestions!
The attach point is either going to be a domNode or a Widget based on whether it has a dojoType or not so if you have an attachPoint to a widgit then you can access connectid with this.myAttachWidget.connectid assuming that the attachPoint is in a widgets template.