The Artima Developer Community
Sponsored Link

Design Forum
Data binding analysis of AJAX DataSet and DBControl in AJAX WebShop

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
king star

Posts: 5
Nickname: kingstar
Registered: Dec, 2006

Data binding analysis of AJAX DataSet and DBControl in AJAX WebShop Posted: Dec 19, 2006 9:21 PM
Reply to this message Reply
Advertisement
Data binding analysis of AJAX DataSet and DBControl in AJAX WebShop

Viky commend
Brief introduction:

Register the Objects list related to data, and when the related events happen, an information should be send to these objects. After they receive these information, the related operation would carry out according to the information ID and data.

Information ID:

modify:12
open:0
refresh:5
close:7
move record:3
append:1
delete:2
firedatachange:6
post:13
cancel:9
apply:8
fieldvalue firechange:4
notify lookup dataset:11

Codes analysis:

Here we will take the DBEdit as the example to analysis the way of data binding.
Set the property of DBEdit as DataSet or SetDataSet. Register DBEdit to the data binding list by LinkObj. Actually, the data binding list is an array. When the events happen in DataSet, system will call Notify to notice all the objects in the list and all the objects have an implement of the interface – HandleMessage to be called by DataSet. Refer to the source code below:

DataSet.prototype.Notify=function(act,recno,p){var os=this.linkobjs;if(!os||this.AutoControl==false)return;for(var j=0;j<os.length;j++)if(os[j].HandleMessage)os[j].HandleMessage(this,act,recn o,p);}

function DC_handlemessage(sender,msg,recno)
{
if(msg!=6&&msg!=12)
this.Refresh();
}
function DC_refresh()
{
var v,f;
if(this.DataSet.Active){
f=this.DataSet.Fields.Field[this.DataField];
if(!f)jcl_err(this.Name+'.DataField:'+this.DataField+Err_NoField);
if(f){
this.readOnly=f.ReadOnly;
v=f.GetValue();
if(v==null)v='';this.value=v;
if(this.Type=='span')this.innerHTML=v;//DBLabel
if(this.Type=='checkbox'){
if(this.CheckedValue == v){
this.checked=true;
this.defaultChecked=true;
}
else{
this.checked=false;
}
}
}
}
else{
this.value='';
if(this.Type=='span')this.innerHTML='';//DBLabel
}
}

AJAX tool from http://www.joyistar.com

Topic: Goals of good software design Previous Topic   Next Topic Topic: Recommend a Professional User Interface Design site

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use