本帖最后由 黑冰.cn 于 2013-11-6 17:18 编辑
A:想要实现DEMO中的左侧点击树,在右侧打开怎么做
Q:下载此示例
A:下载的DEMO运行提示Ext未定义怎么办
Q:下载extjs,放到项目根目录,传送门http://fineui.com/bbs/forum.php?mod=viewthread&tid=3218
A:搭建项目老是出错怎么办
Q:下载空项目,传送门>>http://fineui.com/bbs/forum.php?mod=viewthread&tid=2123
A:fineui中 Js怎么打开window
Q:代码示例:X("WindowID").box_show("/Trust/Accept.aspx?ID=12","受理委托");
A:我想Alert.Show("保存成功");后关闭window如何做啊
Q:PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference() + Alert.GetShowInParentReference("保存成功!"));
A:DorpDownList支持多选吗
Q:不支持
A:Formrow之间的行距太小,如何增宽一点
Q:在页面中加入CSS
.x-form-item {margin-bottom: 8px;}
A:Grid控件,某行某个字段值满足一定条件时,该字段值变红
Q:用TemplateField<ext:TemplateField>
<itemTemplate>
<%# WrapColor(Eval("studentStatus"),"休学","red")%>
后台
protected string WrapColor(object value,string condition,string color){
var val = value.ToString();
return string.format("<span style='color:{1}'>{0}</span>",val,val==condition?color:"");
}
其它小技巧:
Grid单元格换行
.x-grid-tpl,.ext-ie .x-grid3-cell-inner, .ext-ie .x-grid3-hd-inner {
white-space: normal;
}
Grid模板列内容行距
.x-grid-tpl {
line-height: 22px;
}
Grid行高
.x-grid3-row-table tr{ height: 25px;}
Grid分页工具条上的合计及字体调整
C#代码:
var list = bEmployee.GetList(page + 1, GridList.PageSize, where.ToString(), out total);
lblSum.Text = list.Sum(p=>p.DebtNeed).ToString("0.00");
设计代码:
<PageItems>
<ext:Label runat="server" Text="未收款合计:" CssStyle="margin-left:100px;"></ext:Label>
<ext:Label runat="server" ID="lblSum" Text="0.00" CssClass="sum"></ext:Label>
</PageItems>
CSS:
.sum span{
font-weight: bold !important;
font-size: 14px !important;
color: red !important;
}
Form输入控件提示的字体大小调整
.x-tip .x-tip-body{ font-size: 12px;}
Toolbar中的文本框响应回车执行查询
设计代码:
<ext:Toolbar ID="Toolbar1" runat="server" Position="Top">
<Items>
<ext:TextBox ID="txtProjectName" runat="server" EmptyText="工程名称查询.."></ext:TextBox>
<ext:ToolbarSeparator ID="ToolbarSeparator2" runat="server"></ext:ToolbarSeparator>
<ext:Button ID="btnSearch" runat="server" Icon="SystemSearch" Text="查询"></ext:Button>
</Items>
</ext:Toolbar>
JS脚本:
<script>
function onReady() {
var txtProjectName = Ext.getCmp('<%=txtProjectName.ClientID %>');
txtProjectName.on('specialkey', function (box, e) {
if (e.getKey() == e.ENTER) doSearch();
});
function doSearch() {
//触发btnSearch的单击事件,执行查询
X.disable('<%=btnSearch.ClientID %>');
__doPostBack('<%=btnSearch.UniqueID %>', '');
}
}
</script>
C#代码
protected void BtnSearchClick(object sender, EventArgs e)
{
BindGrid(0);
}
private void BindGrid(int page)
{
int total;
var projectName = txtProjectName.Text;
var list = bTrust.GetList(page + 1, GridList.PageSize, projectName, out total);
GridList.DataSource = list;
GridList.RecordCount = total;
GridList.PageIndex = page;
GridList.DataBind();
}
防止在readonly的文本框中按backspace键回到历史页面
function onReady() {
//作用于Firefox、Opera
document.onkeypress=banBackSpace;
//作用于IE、Chrome
document.onkeydown=banBackSpace;
}
//处理键盘事件 禁止后退键(Backspace)密码或单行、多行文本框除外
function banBackSpace(e){
var ev = e || window.event;
var obj = ev.target || ev.srcElement;
var t = obj.type || obj.getAttribute('type');
var vReadOnly = obj.readOnly;
var vDisabled = obj.disabled;
vReadOnly = (vReadOnly == undefined) ? false : vReadOnly;
vDisabled = (vDisabled == undefined) ? true : vDisabled;
var flag1= ev.keyCode == 8 && (t=="password" || t=="text" || t=="textarea")&& (vReadOnly==true || vDisabled==true);
var flag2 = ev.keyCode == 8 && t != "password" && t != "text" && t != "textarea";
if(flag2 || flag1)return false;
}
|