this.View.GetControl<EntryGrid>("FEntity").SetBackcolor("FEntriyText1", "#FFFFFF00", 1);
//设置某列为Linkbutton样式展示。前提是必须是不可用的列
this.View.GetControl<EntryGrid>("FEntity").SetXColDspCtrlType("FEntriyText1", "kdlinkbutton");
//设置某个单元格,为不可用状态
JSONObject job = new JSONObject();
job["key"] = "FEntriyText1".ToUpper();
job["row"] = 1;
job["disabled"] = true;
this.View.GetControl<EntryGrid>("FEntity").InvokeControlMethod("UpdateFieldStates", job);
提示:可编辑设置背景色是无效果的,改变某列的展示样式(按钮,链接)也是在无效的,都必须在不可用的前提下
单据列表 根据左边树形节点 单击 右边列表显示不同颜色 有效果,后续又同学需要 可以参考下:
private int mm = 0;
public override void TreeNodeClick(Kingdee.BOS.Core.DynamicForm.PlugIn.Args.TreeNodeArgs e)
{
base.TreeNodeClick(e);
if (!string.IsNullOrWhiteSpace(e.NodeId) && !(e.NodeId == "0"))
{
var grid = this.ListView.GetControl<EntryGrid>("FList");
if (this.ListView.CurrentSelectedRowInfo !=null)
{
this.ListView.CurrentSelectedRowInfo.Selected = false;
}
// this.ListView.CurrentPageRowsInfo[mm].Selected = false;
List<KeyValuePair<int, string>> colors = new List<KeyValuePair<int, string>>();
KeyValuePair<int, string> keyValue = new KeyValuePair<int, string>(mm, "#FFFFFF");
colors.Add(keyValue);
grid.SetRowBackcolor(colors);
// this.ListView.Refresh();
mm = 0;
// int row = this.ListView.Model.GetEntryRowCount("FList");
ListSelectedRowCollection col = this.ListView.CurrentPageRowsInfo as ListSelectedRowCollection;
if (col != null)
{
for (int i = 0; i < col.Count; i++)
{
if (col[i].PrimaryKeyValue == e.NodeId)
{
mm = col[i].RowKey;
col[i].Selected = true;
break;
}
}
}
colors = new List<KeyValuePair<int, string>>();
keyValue = new KeyValuePair<int, string>(mm, "#FF0000");
colors.Add(keyValue);
grid.SetRowBackcolor(colors);
}
}