Ancho del botón Dojo en porcentaje

I have a Dojo button inside a Dojo Contentpane.

I have configured Dojo button width in percentage, but it is not taking effect.

button = new dijit.form.Button({
    id: "mybutton",
    label: "title",
    style: "width: 70%; top: 10px; left: 20px;"
}, ContentPane);

node = button.domNode;
node.style.position = "absolute";
node.style.left = "10px";
node.style.top = "20px";
node.style.width = "70%";

Button displaying based on button "label" property, actually not occupying 70% width of ContentPane.

preguntado el 08 de noviembre de 11 a las 19:11

How is the parent pane being styled? What happens if you try to change the button width yourself using firebug or something like that? -

Does it make a difference it you set it as block rather than inline? node.style.display = "block"; -

1 Respuestas

First, in your CSS, define a class like this :

.claro .dijitButton .dijitButtonNode, .button {
    width : 70%;
}

(Replace .claro with whatever theme name you are using).

Then, on your javascript, just do :

// Assuming your contentPane div has an id "contentPane"
var contentPane = dijit.byId("contentPane");
var button = new dijit.form.Button({
    id: "mybutton",
    label: "title",
    class : "button"
});
contentPane.set("content", button);

respondido 09 nov., 11:19

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.