form not bind grid

form already bind grid ,use $$(“myform”).bind($$(“mygrid”)).I click the second row of grid,form display second row of value,after I Changed,click save buton of form,save data to database,clear form,mygrid.unselectall.but I now retry click the second row of grid,form not display value,is empty.after I click other row,again click the second row of grid,form can display the second row value.not add row,is change.why?
var validobj = {
yyrq:{errmsg:“Not Empty。”},
yygp:{errmsg:“Not Empty。”},
yyzl:{errmsg:“Is Number。”},
sgry:{errmsg:“Not Empty。”},
cphm:{errmsg:“Not Empty。”}
};
dhx.ready(function(){
dhx.ui({
view:“popup”,
id:“yyrq_popup”,
body:{
view:“calendar”,
id:“yyrq_calendar”,
cellHeight:“auto”,
weekHeader:true,
startOnMonday:false
}
}).hide();
dhx.ui({
view:“popup”,
id:“sgry_popup”,
body:{
view:“list”,
id:“sgry_list”,
url:encodeURI(“get_czry_json.asp”),
datatype:“json”,
select:true
}
}).hide();
dhx.ui({
view:“popup”,
id:“shdd_popup”,
body:{
view:“list”,
id:“shdd_list”,
url:encodeURI(“get_xswd_json.asp”),
datatype:“json”,
select:true
}
}).hide();
var config = {
type:“wide”, rows:[
{view:“form”, id:“myform”, width:1024, height:170, elements:[
{type:“clean”, rows:[
{type:“clean”, cols:[
{view:“text”, id:“yyrq”, label:“yyrq”, labelWidth:80, popup:“yyrq_popup”, readonly:true},
{view:“richselect”, id:“yygp”, label:“yygp”, labelWidth:80, datatype:“json”, url:encodeURI(“get_gpzd_json.asp”)},
{view:“text”, id:“yyzl”, label:“yyzl”, labelWidth:80},
{view:“text”, id:“sgry”, label:“sgry”, labelWidth:80, popup:“sgry_popup”, readonly:true}
]},
{type:“clean”, cols:[
{view:“text”, id:“gpyq”, label:“gpyq”, labelWidth:80, width:512},
{view:“richselect”, id:“fhdd”, label:“fhdd”, labelWidth:80, datatype:“json”, url:encodeURI(“get_fhdd_json.asp”)},
{view:“text”, id:“shdd”, label:“shdd”, labelWidth:80, popup:“shdd_popup”, readonly:true}
]},
{type:“clean”, cols:[
{view:“text”, id:“cphm”, label:“cphm”, labelWidth:80, width:512},
{view:“text”, id:“sjdh”, label:“sjdh”, labelWidth:80},
{view:“text”, id:“qbyf”, label:“qbyf”, labelWidth:80}
]},
{type:“clean”, cols:[
{view:“button”, type:“form”, id:“save”, label:“save”, inputWidth:150, align:“center”, click:“save”},
{view:“button”, type:“form”, id:“remove”, label:“remove”, inputWidth:150, align:“center”, click:“remove”},
{view:“button”, type:“form”, id:“reset”, label:“reset”, inputWidth:150, align:“center”, click:“reset”}
]}
]}
],
rules:{
yyrq:dhx.rules.isNotEmpty,
yygp:dhx.rules.isNotEmpty,
yyzl:dhx.rules.isNumber,
sgry:dhx.rules.isNotEmpty,
cphm:isValidCphm
}},
{view:“grid”, id:“mygrid”, width:1024, scroll:“y”, header:true, sorting:false, select:true, datatype:“json”, url:encodeURI(“get_gpyy_json.asp”),
fields:[
{id:“sn”, label:“sn”, width:48, align:“center”, template:"#sn#"},
{id:“yyrq”, label:“yyrq”, width:100, align:“center”, template:"#yyrq#"},
{id:“yygp”, label:“yygp”, width:80, align:“center”, template:"#yygp#"},
{id:“yyzl”, label:“yyzl”, width:80, align:“right”, template:"#yyzl#"},
{id:“sgry”, label:“sgry”, width:125, align:“center”, template:"#sgry#"},
{id:“gpyq”, label:“gpyq”, width:85, align:“left”, template:"#gpyq#"},
{id:“fhdd”, label:“fhdd”, width:100, align:“center”, template:"#fhdd#"},
{id:“shdd”, label:“shdd”, width:110, align:“center”, template:"#shdd#"},
{id:“cphm”, label:“cphm”, width:101, align:“center”, template:"#cphm#"},
{id:“sjdh”, label:“sjdh”, width:115, align:“center”, template:"#sjdh#"},
{id:“qbyf”, label:“qbyf”, width:80, align:“right”, template:"#qbyf#"}
]
}
]
}
dhx.ui(config);
//loading
dhx.extend($$(“mygrid”), dhx.ui.overlay);
dhx.extend($$(“myform”), dhx.ui.overlay);
//render
$$(“mygrid”).render();
//bind
$$(“myform”).bind($$(“mygrid”));
$$(“myform”).attachEvent(“onValidationError”, function(id, data){
dhx.alert({
title:“warm”,
message:validobj[id].errmsg,
labelOk:“ok”
});
})
$$(“yyrq_calendar”).attachEvent(“onDateSelect”, function(){
var yyrq = dhx.i18n.dateFormatStr($$(“yyrq_calendar”).getSelectedDate());
$$(“yyrq_calendar”).hide();
$$(“yyrq”).setValue(yyrq);
$$(“yyrq”).refresh();
})
$$(“sgry_list”).attachEvent(“onitemclick”, function(id, ev, trg){
var sgry = $$(“sgry”).getValue();
if (sgry.indexOf(id) < 0){
if (sgry == “”){
$$(“sgry”).setValue(id);
}else{
$$(“sgry”).setValue(sgry + “,” + id);
}
}else{
dhx.alert({
title:“warm”,
message:“repeat:” + id + “!”,
labelOk:“ok”
});
}
})
$$(“shdd_list”).attachEvent(“onitemclick”, function(id, ev, trg){
var shdd = $$(“shdd”).getValue();
if (shdd.indexOf(id) < 0){
if (shdd == “”){
$$(“shdd”).setValue(id);
}else{
$$(“shdd”).setValue(shdd + “,” + id);
}
}else{
dhx.alert({
title:“warm”,
message:“repeat:” + id + “!”,
labelOk:“ok”
});
}
})
$$(“mygrid”).attachEvent(“onbeforeselect”, function(id){
if (getCookie(“fz”) == “super” || getCookie(“fz”) == “manager”){
return true;
}
else{
return false;
}
});
})
isValidCphm = function(value) {
if (value.length == 0){
return true;
}else if (value.length > 0 && value.length == 7){
return true;
}else{
return false;
}
}
//save
function save(){
if ($$(“myform”).validate()){
var yyrq = $$(“yyrq”).getValue();
var yygp = $$(“yygp”).getValue();
var yyzl = $$(“yyzl”).getValue();
var sgry = $$(“sgry”).getValue();
var gpyq = $$(“gpyq”).getValue();
var fhdd = $$(“fhdd”).getValue();
var shdd = $$(“shdd”).getValue();
var cphm = $$(“cphm”).getValue().toUpperCase();
var sjdh = $$(“sjdh”).getValue();
var qbyf = $$(“qbyf”).getValue();
var data = “yyid=” + $$(“mygrid”).getSelected() + “&yyrq=” + yyrq + “&yygp=” + yygp + “&yyzl=” + yyzl + “&sgry=” + sgry + “&gpyq=” + gpyq + “&fhdd=” + fhdd + “&shdd=” + shdd + “&cphm=” + cphm + “&sjdh=” + sjdh + “&qbyf=” + qbyf;
$.ajax({
type:“post”,
url:“input_gpyy_save.asp”,
data:data,
dataType:“json”,
cache:false,
beforeSend:function(jqXHR, settings){
//loading
$$(“myform”).showOverlay();
},
complete:function(jqXHR, textStatus){
//loading
$$(“myform”).hideOverlay();
},
success:function(data){
var newRecord = {
id:data.yyid,
yyrq:yyrq,
yygp:yygp,
yyzl:yyzl,
sgry:sgry,
gpyq:gpyq,
fhdd:fhdd,
shdd:shdd,
cphm:cphm,
sjdh:sjdh,
qbyf:qbyf
};
if (!$$(“mygrid”).exists(data.yyid)){
$$(“mygrid”).add(newRecord);
}
else{
$$(“mygrid”).update(data.yyid,newRecord);
}
$$(“mygrid”).refresh(data.yyid);
total();
reset();
dhx.alert({
title:“tip”,
message:“succ!”,
labelOk:“ok”
});
},
error:function(jqXHR, textStatus, errorThrown){
dhx.alert({
title:“warm”,
message:“busy!”,
labelOk:“ok”
});
}
});
}
}
function remove(){
var id = $$(“mygrid”).getSelected();
if (id){
dhx.confirm({
title:“warm”,
message:“sure”,
labelOk:“ok”,
labelCancel:“cancle”,
callback:function(result){
if (result){
var data = “yyid=” + id;
$.ajax({
type:“post”,
url:“delete_gpyy.asp”,
data:data,
dataType:“json”,
cache:false,
beforeSend:function(jqXHR, settings){
//loading
$$(“myform”).showOverlay();
},
complete:function(jqXHR, textStatus){
//loading
$$(“myform”).hideOverlay();
},
success:function(data){
$$(“mygrid”).remove(id);
total();
reset();
dhx.alert({
title:“tip”,
message:“succ!”,
labelOk:“ok”
});
},
error:function(jqXHR, textStatus, errorThrown){
dhx.alert({
title:“warm”,
message:“busy!”,
labelOk:“ok”
});
}
});
}
}
})
}
};
function reset(){
$$(“myform”).clear();
$$(“sgry_list”).unselectAll();
$$(“shdd_list”).unselectAll();
$$(“mygrid”).unselectAll();
$$(“yyrq_calendar”).setValue(getCurDate());
}
//sort
function total(){
var dc = $$(“mygrid”).dataCount();
for(var i=0;i<dc;i++){
var id = $$(“mygrid”).idByIndex(i);
$$(“mygrid”).item(id).sn = i + 1;
$$(“mygrid”).refresh(id);
}
}

where is Alexandra?help me!thanks!

Alexandra?

Hello,

here is the demo with working list-form binding (list and grid work equally with data):
dhtmlxTouch_v12_120913/samples/10_server/02_saving/03_list_dataprocessor.html
The second row can be edited again after saving form and calling unselect or unselectAll for list.

If you want we take a look at your app, you can provide a direct link to the problematic page or attach modified dhtmlxTouch_v12_120913/samples/10_server/02_saving/03_list_dataprocessor.html sample so that the problem will occur in it.

I now use touchui.js version is v1.0,after update to v1.2,the problem solved.
thanks!