1.1 How to change the text of the Messager.confirm popover button without changing the style of the selection box interface:
In general, the Messager.confirm Pop-up button defaults to "Confirm" and "Cancel", of course, the Chinese package has been added here, the default is, "OK" and "cancle".
In many cases, we directly use $.messager.defaults= {OK: "Pass", Cancel: "Do not Pass"}; If this changes directly, the style of pop-up selection box changes directly, we use
$.extend ($.messager.defaults,{
OK: "Pass",
Cancel: "Do not pass"
});
Effectively solves the selection box style remains the same and the text effectively replace the problem.
1.2 How to tell if Var contains another string in JS:
We in the actual, often in the interface to use the judgment statement, such as we do a batch of delete, but to delete the message to make a judgment, can not delete the status of "published, has been audited to be released, the network to be audited, the network does not pass" PS: Status for each traversal gets the state on the page
var status = '
$.each (checked, function (index, item) {
Status = Status + Item. STATUS + ', ';
});
if (! ( Status.indexof (' released ') >-1) &&! (Status.indexof (' audited for release ') >-1) &&! (Status.indexof (' Remove network Pending review ') >-1) &&! (Status.indexof (' Remove the net not through ') >-1)) {
Delete code
}
1.3 If any of the first seven characters in the database field are displayed in JS, the mouse hovers over all the contents.
{field: ' Notice_desc ', width:110,align: ' Left ', halign: ' Center ', title: ' Description ', Formatter:function (Value,row,index) {
var len = row. Notice_desc.length;
var abvalue = row. Notice_desc;
if (Len > 8) {
abvalue = row. Notice_desc.substr (1,7) + "...";
}
return ' <text href= ' # "title=" ' + row. Notice_desc + ' "class=" note "> ' + abvalue + ' </text> ';
} },
{field: ' Update_user ', width:100,align: ' Left ', halign: ' Center ', title: ' Maintainer '},
{field: ' Update_time ', width:110,align: ' Center ', halign: ' Center ', title: ' Maintenance Time '}
]]
});
This allows us to successfully process the Description field effectively.
1.4 How to implement when judging the length of a string, English characters +1, kanji +2
Calculate title and description string length (1 characters in English, Chinese characters 2 characters)
Businesstype and description are key values
var len_businesstype = 0;
for (var i = 0; i < businesstype.length; i++) {
var c = businesstype.charcodeat (i);
Single byte plus 1
if ((c >= 0x0001 && C <= 0x007e) | | (0xff60 <= c && C <= 0xff9f)) {
len_businesstype++;
}
else {
Len_businesstype + = 2;
}
}
if (Len_businesstype > 16) {
Alert ("Input notification type name cannot exceed 8 characters, please re-enter");
Return
}
var len_description = 0;
for (var i = 0; i < description.length; i++) {
var c = description.charcodeat (i);
Single byte plus 1
if ((c >= 0x0001 && C <= 0x007e) | | (0xff60 <= c && C <= 0xff9f)) {
len_description++;
}
else {
Len_description + = 2;
}
}
if (Len_description > 60) {
Alert ("Input description information should not exceed 30 characters, please re-enter");
Return
}
1.5 Sometimes when we add a title, or add a user, to determine whether the unique, usually we will, the database field is set to a unique indicator, and then catch the exception to the user a reasonable hint, otherwise it will prompt "system error", but if the title or user name (to determine the value) less time, We can also in the new save, go to the database to sweep, if already exist, the hint "already exists", if not exist, execute Save Method!
Notification announcement NEW
public int Savemanage (map<string, string> param) throws businessexception {
if (Checkexi (Param.get ("Notice_title"))!=0) {
throw new Businessexception ("This title already exists!") ");
}
Return update ("Com.resoft.infodisc.central.informationmaintenance.mappings.noticeManagementFaDao.saveManage", param);
}
Notification Announcement title New unique check
public int Checkexi (String notice_title) {
map<string, object> parammap = new hashmap<string, object> ();
Parammap.put ("Notice_title", notice_title);
Return Checkexist ("Com.resoft.infodisc.central.informationmaintenance.mappings.noticeManagementFaDao.checkExi", PARAMMAP);
}
Then, in the DAO layer XML, write a query for Checkexi according to the title.
1.6 When using Easyui-combobox, the content of the drop-down menu is not written on the page but is removed from a class of characters wrongly written segments in the database.
<TD style= "padding-left:10px" > Bulletin Type: <select name= "R2" id= "R2" class= "Easyui-combobox" style= "width:200px"
data-options= "Editable:false, url: ' ${ctx}/central/informationmaintenance/notice/getmanage?type=root ', Method: ' Post ', Valuefield: ' Code ', TextField: ' Name ', icons:[{
Iconcls: ' Icon-clear ',
Handler:function (e) {
$ (E.data.target). ComboBox (' Clear ');
}
}] ">
</select>
</td>
Then in the control layer give Getmanage a method, in the service layer return value for List,xml write a query can
1.7 New judgment in the database, sometimes we do an audit button, to update the database field, such as the field is "0" is updated to "1", if the field is "4" is updated to "6", we can in the XML directly to the UPDATE statement with case and when, Long knowledge of the original new can also use case, not just query oh.
<!--announcement review--
<update id= "Checknotice" parametertype= "Java.util.Map" >
UPDATE T_announce_notice_info
SET STATUS = (
Case STATUS
When ' 0 ' then ' 1 '
When ' 4 ' then ' 6 '
End)
WHERE notice_id = #{id} and (status = ' 0 ' or status = ' 4 ')
</update>
1.8 When you open a page, sometimes you need to load the data directly onto the page, the way to load the data into the page a lot, the simplest is to directly use the Ready method, then a query statement to check, and then pass the value to the interface.
//data load
//var html = ' <table id= ' informationadddatagrid ' ></table> ' ;
$ (document). Ready (function () {
var row = $ (' #announcementNoticeListDataGrid '). DataGrid (' getselected ') ;
var param = {Notice_id:row. NOTICE_ID};
//alert (param. NOTICE_ID);
$.post ("${ctx}/client/announcementmanagement/loadnotice", param,function (data) {
$ (' # Form '). Form (' Load ', data);
$ (' #pDate '). HTML (data. Publish_date);
$ (' #pTitle '). HTML (data. Notice_title);
//alert (data. notice_content);
//document.getelementbyid ("type"). InnerHTML = data. notice_content;
}, "JSON");
});
Here the method name of the control layer is "Loadnotice", according to the ID of a field to take value, you can consider not encapsulation, direct value, but if the subsequent needs, and then to the map to make it worthwhile, encapsulation is relatively convenient, so, it is best not to take the interface from the screen number of fields, are encapsulated and then in the pass value (if it is not necessary, can not be encapsulated), here with the Load method, automatically load the data, but remember the name of the database and the names of the bullets to correspond! , PDate ' and Ptitle ' are directly to the P tag, regardless of the style of HTML text, and the content word Gencun is HTML text, can not be directly loaded, for example, in the interface, the space and the line of wrapping is in the format of the HTML stored in the database, When the acquisition is also HTML text, so that in the direct display will often lose space and line, and so on, you can consider using Ckediter, I used to directly add a textbox, and then to change the background color.
How to map mosaic such as from the database to find the category of "male" and "female", but often the page needs a "all", and "all" can not exist in the database, but also in the query to obtain the "all" key value, will be described in the next section.
JAVA Essay (i)