prototype.js and DHTMLXTouch

Hi all,

is it known and/or wanted, that the usage of prototype disables DHTMLX Touch?

Thx, Pit.

There is no principal conflict here, prototype lib just uses $$ method for their own scenarios.
So, in dhtmlx touch related code, instead of

$$('list').do_some();

you can use

dhx.ui.get('list').do_some();

Hi Stanislav,

thanks for your reply.

Unfortunately it seems not to work if I replace every “$$(” on the toplevel.

I just took one of your samples (form/03.onclick.html) and changed it.

It does not run with prototype. Was it meant to change the whole DXHTML-Libs?

Regards, Pit.

==================================================

Form html { overflow:scroll; }
    html,body{
        background-color:#ffffff;
    }
    </style>
        
	<textarea style="width:200px;height:100px;display:none" name="xml" id="xml">
		<data>
			<field_a>Minsk</field_a>
			<field_b>London</field_b>
			<field_c>180</field_c>
			<field_d>Check filght</field_d>
			<field_e>2</field_e>
			<field_m>3</field_m>
			<field_f></field_f>
			<field_g>right</field_g>
			<field_g1>1k</field_g1>
			<field_h>0</field_h>
			<field_i>i1</field_i>
			<field_j>0</field_j>
			<field_k>1</field_k>
		</data>
	</textarea>
    <div id="actions" style="border:1px solid #A4BED4;position:absolute;top:50px; left:850px;background-color:white;width:400px;height:396px;overflow:auto; float:left;"></div>
	
	<script type="text/javascript" charset="utf-8">
	
	
	var ui = dhx.ui({
			rows:[
					{ 	view:"toolbar", type:"MainBar", data:[
							{ type:"button", label: 'Clear', click:"clear_form" },
							{ type:"button", label: 'Set', click:"set_form" },
							{ type:"button", label: 'Get', click:"get_form" },
							{ type:"button", label: 'Parse from XML', click:"parse_xml" }
						]
					},
					{ 	view:"form", id:"myform", data:[
							{ type:"text", name:"field_a", id:'field_a', label: 'from', value: "Moscow", position: "label-left", inputWidth: 250, labelWidth: 100, align: "center", labelAlign: "center", click:"log"},
							{ type:"text", name:"field_b", id:'field_b', sameLine:true, label: 'to', value: "Guatemala", position: "label-left", inputWidth: 250, labelWidth: 100,click:"log"},
							{ type:"counter", name:"field_c", id:'field_c', label: 'passengers 12+', step: 1, width: "auto", value: 1, min: 1, max: 20, labelWidth: 150, position: "label-left", labelAlign: "left",click:"log"},
							
							{ type:"list", name: "field_e", id:'field_e', label: 'Type', click:"log", value: "1", y_count:"3", align: "right", labelAlign: "right", data:[
									{ id:"1", value:"One"   },
									{ id:"2", value:"Two"   },
									{ id:"3", value:"Three" }
								],template:"#value#"},
							{ type:"combo",sameLine:true, name: "field_m", id:'field_m', click:"log", label: 'Combo', value:"1", y_count:"3", data:[
									{ id:"1", value:"One"   }, 
									{ id:"2", value:"Two"   }, 
									{ id:"3", value:"Three" }
								],template:"#value#"},
							{ type:"calendar",sameLine:false, name: "field_f", label: 'Date', click:"log", id:'calendar',date:new Date(2010,07,10)},
							
							{ type:"toggle", name: "field_g", id:'field_g', click:"log", options: ["Roundtrip","Oneway"], values: ["left", "right"], align: "right" },
							
							{ type:"radio", name:"field_i", id:'field_i', click:"log", labelWidth: 250, labelAlign: "left",value:"2", data:[
								{ label:"only direct flights", value: "1" },
								{ label:"any flights", value: "2" },
							] },
							{ type:"checkbox", name: "field_j", id:'field_j', click:"log", label:"find hotels", position:"label-left",labelWidth: 100,labelAlign:"right", value: 1},
							{ type:"checkbox", name: "field_k", id:'field_k', click:"log", label:"find car here", labelWidth: 100,labelAlign:"right", position: "label-left",sameLine:true},
							{ type:"form_button", name: "field_d", id:'field_d', click:"log", value: 'Find flight', align:"center", align:"center",width: 290 }						
						]
					}
			]
		});
        
        function set_form(){
			dhx.ui.get('myform').setValues({
				field_a: "Minsk",
				field_b: "Deli",
				field_c: 180,
				field_d: "Button",
				field_e: "3",
				field_f: "2010-12-25",
				field_g: "right",
				field_h: 1,
				field_i: "i2",
				field_j: false,
				field_k: true
			});
		};
		function clear_form(){
			dhx.ui.get('myform').clear();
		};
		function get_form(){
			console.dir(dhx.ui.get('myform').getValues());
		};
		
		function parse_xml(){
			//alert(document.getElementById("xml").value)
			dhx.ui.get('myform').parseValues(document.getElementById("xml").value,"xml");
		};
		function log(){
            var message="onclick";
            var div="<div>";
            message+='<ul style="padding:0 0 0 22px;margin:0;font:italic 60% verdana">';
            for (var i=0; i < arguments.length; i++) {
                message+="<li>"+arguments[i];
            };
            message+='</ul>';
            div+=message+"</div";
            document.getElementById('actions').innerHTML=div+document.getElementById('actions').innerHTML;
        }
	</script>
</body>

Yep, there is a little problem with calendar and list type ( form elements with popups ), currently they will not work with prototype.

Will be fixed in next version.

You can hotfix it manually , by replacing $$ occurences in touch.js with dhx.ui.get

Thanks!

Ok - I temporarily got around this problem by using (and learning) the Ajax communication from dhtlmx instead of prototype and the JSON from json2.

Regards, Pit.