/// <summary> /// 过滤查找 /// </summary> public void filterSearch() { String sText = m_searchTextBox.Text.ToUpper(); m_grid.beginUpdate(); m_grid.clearRows(); int row = 0; CList <Security> securities = SecurityService.FilterCode(sText); if (securities != null) { int rowCount = securities.size(); for (int i = 0; i < rowCount; i++) { Security security = securities.get(i); FCGridRow gridRow = new FCGridRow(); m_grid.addRow(gridRow); gridRow.addCell(0, new FCGridStringCell(security.m_code)); gridRow.addCell(1, new FCGridStringCell(security.m_name)); row++; } } securities.delete(); m_grid.endUpdate(); }
/// <summary> /// 加载表格的模板 /// </summary> /// <param name="node">节点</param> public static void GridTemplate(FCGrid grid, UIXmlEx xml, XmlNode node) { XmlDocument xmlDoc = node.OwnerDocument; grid.Size = new FCSize(200, 200); FCGridColumn column = new FCGridColumn("Column1"); grid.addColumn(column); FCGridColumn column2 = new FCGridColumn("Column2"); grid.addColumn(column2); grid.update(); FCGridRow row = new FCGridRow(); grid.addRow(row); FCGridStringCell cell = new FCGridStringCell(); cell.setString("Cell1"); row.addCell(0, cell); FCGridStringCell cell2 = new FCGridStringCell(); cell2.setString("Cell2"); row.addCell(1, cell2); grid.update(); XmlNode columnsNode = xmlDoc.CreateNode(XmlNodeType.Element, "tr", ""); node.AppendChild(columnsNode); XmlNode column1Node = xmlDoc.CreateNode(XmlNodeType.Element, "th", ""); column1Node.InnerText = "Column1"; columnsNode.AppendChild(column1Node); XmlNode column2Node = xmlDoc.CreateNode(XmlNodeType.Element, "th", ""); column2Node.InnerText = "Column2"; columnsNode.AppendChild(column2Node); XmlNode rowNode = xmlDoc.CreateNode(XmlNodeType.Element, "tr", ""); node.AppendChild(rowNode); XmlNode cellNode1 = xmlDoc.CreateNode(XmlNodeType.Element, "td", ""); rowNode.AppendChild(cellNode1); cellNode1.InnerText = "Cell1"; XmlNode cellNode2 = xmlDoc.CreateNode(XmlNodeType.Element, "td", ""); rowNode.AppendChild(cellNode2); cellNode2.InnerText = "Cell2"; }
/// <summary> /// 创建表格行 /// </summary> /// <param name="node">节点</param> /// <param name="control">控件</param> protected virtual void createGridRow(XmlNode node, FCView control) { FCGrid grid = control as FCGrid; FCGridRow row = new FCGridRow(); grid.addRow(row); setAttributesBefore(node, row); //单元格 int col = 0; foreach (XmlNode node3 in node.ChildNodes) { String subNodeName = node3.Name.ToLower(); String subNodeValue = node3.InnerText; if (subNodeName == "cell" || subNodeName == "td") { String cellType = "string"; HashMap <String, String> attributes = getAttributes(node3); if (attributes.containsKey("type")) { cellType = attributes.get("type"); } attributes.clear(); FCGridCell cell = null; if (cellType == "bool") { cell = new FCGridBoolCell(); } else if (cellType == "button") { cell = new FCGridButtonCell(); } else if (cellType == "checkbox") { cell = new FCGridCheckBoxCell(); } else if (cellType == "combobox") { cell = new FCGridComboBoxCell(); } else if (cellType == "double") { cell = new FCGridDoubleCell(); } else if (cellType == "float") { cell = new FCGridFloatCell(); } else if (cellType == "string") { cell = new FCGridStringCell(); } else if (cellType == "int") { cell = new FCGridIntCell(); } else if (cellType == "long") { cell = new FCGridLongCell(); } else if (cellType == "textbox") { cell = new FCGridTextBoxCell(); } row.addCell(col, cell); setAttributesBefore(node3, cell); cell.setString(subNodeValue); setAttributesAfter(node3, cell); col++; } } setAttributesAfter(node, row); }