ExtJs使用小结

来源:互联网 发布:linux执行命令 编辑:程序博客网 时间:2024/05/18 03:09





自动匹配


<span style="font-size:18px;">/* * 自动匹配 */页面调用:getautocomplete(ctx+'/ajaxAction.do?method=json&common=getUserinfo&classes=indicatorConfServiceImpl', 'username','name');需要引入:<script type="text/javascript" src="${ctx}/base/commons/scripts/jquery.autocomplete.js"></script>function getautocomplete(url,autoid,type){$.getJSON(url, function(data){data = data.list;var parsed = [];for (var i = 0; i < data.length; i++) {parsed[parsed.length] = {name : data[i].name,to : data[i].to}}if(type!=0&&!type){//操作类型为空说明获取的是id否则为$("#"+autoid).autocomplete(parsed, {//  max: 10,    //列表里的条目数minChars : 0, //自动完成激活之前填入的最小字符//width : 160, //提示的宽度,溢出隐藏scrollHeight : 200, //提示的高度,溢出显示滚动条scroll : true,matchContains : true, //包含匹配,就是data参数里的数据,是否只要包含文本框里的数据就显示autoFill : false, //自动填充formatItem : function(row, i, max) {return row.name;},formatMatch : function(row, i, max) {return row.name;},formatResult : function(row) {return row.name;}}).result(function(event, row, formatted) {$("#"+autoid).val(row.to);});}else{var ids=autoid.split("#");var twoID=false;if(ids.length==2){twoID=true;autoid=ids[1];}$("#"+autoid).autocomplete(parsed, {//  max: 10,    //列表里的条目数minChars : 0, //自动完成激活之前填入的最小字符//width : 160, //提示的宽度,溢出隐藏scrollHeight : 200, //提示的高度,溢出显示滚动条scroll : true,matchContains : true, //包含匹配,就是data参数里的数据,是否只要包含文本框里的数据就显示autoFill : false, //自动填充formatItem : function(row, i, max) {return    row.name + '(' + row.to + ')';},formatMatch : function(row, i, max) { return row.name + row.to;},formatResult : function(row) {return row.name + '(' + row.to + ')';}}).result(function(event, row, formatted) {if(twoID){$("#"+ids[0]).val(row.to);$("#"+autoid).val(row.name);}else{$("#"+autoid).val(row.name);}});}});}</span>



列显示不全只显示部分


<astyle="white-space:nowrap; text-overflow:ellipsis; overflow:hidden;width:380px;height: 25px;

line-height:25px;display:block;text-align:left;"title="${question.title}"  href="${ctx}/template/web/answer.jsp?questionid=${question.questionid}"target="_blank"></a>




0 0
原创粉丝点击