Olá pessoal!
Quem está trabalhando com ExtJS?
Estou pensando em escrever os fontes em javascript e css a mão para os 3 principais navegadores:
firefox, IE e Safari pois estes 3 representam 95% dos navegadores utilizados.
Como conheço rasoavelmente o javascript e css gostaria de saber a opinião dos que conhecem ExtJs.
É mais rápido construir meus proprios componentes (dentro de minhas necessidades) ou aprender o ExtJs?
Onde encontro um passo a passo sobre ExtJs?
Como o prometido:
/* ponham as 3 fotos que acharem melhor para Pcheckbox1.png, Pcheckbox2.png e Pcheckbox3.png */
<html>
<head>
<script type="text/javascript">
function tristate(texto)
{
this.table = document.createElement("table");
this.tablebody = document.createElement("TBODY");
this.table.cellpadding=0;
this.table.cellspacing=0;
this.table.style.border=0;
this.hidden = document.createElement("input");
this.hidden.setAttribute("type","hidden");
this.tr = document.createElement("TR");
this.td1 = document.createElement("TD");
this.td2 = document.createElement("TD");
this.div = document.createElement("div");
this.div.style.width="16px";
this.div.style.height="16px";
this.div.style.backgroundImage = "url('Pcheckbox1.png')";
this.div.createState = function()
{
this.estado=0;
}
this.div.createState();
this.div.changeState = function()
{
if(this.estado==0)
{
this.estado=1;
this.style.backgroundImage = "url('Pcheckbox2.png')";
}
else if(this.estado==1)
{
this.estado=2;
this.style.backgroundImage = "url('Pcheckbox3.png')";
}
else
{ this.estado=0;
this.style.backgroundImage = "url('Pcheckbox1.png')";
}
}
this.div.onclick = function()
{
this.changeState();
}
this.getState = function ()
{
return this.div.estado;
}
this.setState = function (entre1e3)
{
this.div.estado = entre1e3;
this.div.changeState ();
}
this.getElement = function ()
{
return this.table;
}
this.div.appendChild(this.hidden);
this.td1.appendChild(this.div);
this.td2.appendChild(document.createTextNode(texto));
this.tr.appendChild(this.td1);
this.tr.appendChild(this.td2);
this.tablebody.appendChild(this.tr);
this.table.appendChild(this.tablebody);
}
var estado1=new tristate( "tristate 1" );
var estado2=new tristate( "tristate 2" );
estado2.setState(1);
function getEstado()
{
alert(estado1.getState()+"");
}
function load()
{
document.getElementById("aqui").appendChild( this.estado1.getElement() );
document.getElementById("aqui").appendChild( this.estado2.getElement() );
document.getElementById("aqui").appendChild( new tristate( "tristate 3" ).getElement());
document.getElementById("aqui").appendChild( new tristate( "tristate 4" ).getElement());
document.getElementById("aqui").appendChild( new tristate( "tristate 5" ).getElement());
}
</script>
</head>
<body id="aqui" onload="load();">
<input type="button" onclick="getEstado();" value="pega estado do primeiro checkbox"/>
</body>
</html>