PB11 in order to not make the modify the DW data on the client browser is produced in the server-side callback requests (PostBack, the phenomenon is the screen flicker, especially slow machine), provides a JavaScript script language to solve client events, usually call this way:
1. The first to use any text tool to write your own js script, assuming that named: myscripts. Js
2. The window containing the DW OPEN event code in the forms of writing as follows:
# IF DEFINED PBWEBFORM THEN
Dw_1. JavaScriptFile="myscripts. Js"
Dw_1. OnClientItemChanged="bmbh_ItemChanged"
# END IF
Above mean: if it is published as WebForm application, a script to set DW_1 up the processing function, when the client side project value change, called "bmbh_ItemChanged" function in JS file (to handle the relevant inspection, such as demand)
The following is the function of concrete in JS code:
The function requ_bmbh_ItemChanged (sender, rowNumber, columnName, newValue)
{
If (columnName=="BMBH")
{
//The default function is invoked
Return PBDataWindow_ItemChangedReject (sender, rowNumber, columnName, newValue);
}
The else
{
//do nothing
}
}
Means: the change the value of the field "BMBH" automatically execute PBDataWindow_ItemChangedReject (produces callback), so when you write the PB in DW PowerScript script, actually will execute your code, you can write your processing in ItemChanged event BMBH change the code, such as processing a DDDW to sift through a section of the worker,
At the same time, when other fields change on DW, the browser will not produce the server callback, otherwise if there is no this JS and its function, then any change field values will cause POSTBACK, so look at the screen will be uncomfortable,
These manual file in SYBASE pbman110. CHM are introduced, however, made no mention about deeper introduction, for example, I don't want to write PB scripts in the ItemChanged event, I would like to achieve in JS, purpose, of course, also very directly, just don't have any POSTBACK,
Such as, how to implement?
I see in the NEWSGROUP, many people have a similar question, but seems to have no clear and direct answer, so I after nearly two weeks of groping, solves the problems, such as follows is my published in a paragraph on the NEWSGROUP, to dispense the input problem, I am no longer in detail explained, in crossing carefully listen to it (sorry for poor English),
I have realized this function at last spent two weekes
Both please look my code for example:
The function dw_ERec_ItemChanged (sender, rowNumber, columnName, newValue)
{
If (columnName=="BMBH")
{
//The default function is invoked
Return PBDataWindow_ItemChangedReject (sender, rowNumber
ColumnName, newValue);
}
The else
{
Var dept, doctor;
If (columnName=="dept")
Dept=newValue;
The else
Dept=sender. The GetItem (rowNumber "dept");
If (columnName=="doctor")
Doctor=newValue;
The else
Doctor=sender. The GetItem (rowNumber, "doctor");
Sender. SetItem (rowNumber "comp", dept + "-- -" + doctor);
}
}
!!!!!!!!!!!!!!!!!!! Note: HTDW_SetItem and HTDW_GetItem function in dwcommon. Js
Are the function of the matching type, "HTDW" string must be replaced by
Yourself datawindow name!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
So, replacing it with the "sender".
Here, I have walked in a lot of detours.
The key is the GetItem/SetItem function of the application, pay attention to these two function not PB oh, is JS oh, but I check it dwcommon. JS file, can not find them, only HTDW_SetItem/HTDW_GetItem, then looked at the many other function after suddenly enlighted, originally the HTDW here is a term used to describe a wildcard, not the actual name of the function, the owner must be object to perform, during the newsgroup tip has been DW so-called corresponds to a second array rows to find problems, so has been deceived,
CodePudding user response:
A, ha haCodePudding user response:
LZ seems to have been studying the Webform...Write a blog,
CodePudding user response: