public string GetToolTipData(string eventArgument) { // 16.10.2004, jorn - Added UpdateRowsClick, added support for autosave. if (string.IsNullOrEmpty(eventArgument)) { return(null); } string[] eventArgs = eventArgument.Split('!'); if (eventArgs.Length != 2) { return(null); } string columnName = eventArgs[0]; string EditKey = eventArgs[1]; if (!MasterTable.Columns.Contains(columnName) || string.IsNullOrEmpty(EditKey) || MasterTable.Columns[columnName].ColumnType != ColumnType.ToolTip) { return(null); } EditIndex = EditKey; ToolTipColumn column = ((ToolTipColumn)MasterTable.Columns[columnName]); Row row = Rows[0]; if (row == null) { return("No DataRow found"); } return(column.GetEventData(columnName, EditKey, row)); }
internal override Column Duplicate() { ToolTipColumn c = new ToolTipColumn(ColumnId, m_Table); CopyTo(c); return(c); }
public void ToolTipColumn() { Grid grid = new Grid { DataSourceId = "Order Details", ID = "test", ConnectionString = ConnectionAccessOleDb }; WebGrid.ToolTipColumn tooltipColumn = new WebGrid.ToolTipColumn("tooltipColumn", grid.MasterTable) { ToolTipStyle = StyleName.green, ShowMethod = ShowMethod.dblclick, ToolTipHeight = 300, ToolTipWidth = 400, Text = "WebGrid Loading..", Visibility = Visibility.Both, }; tooltipColumn.BeforeToolTipRender += mytest_BeforeToolTipRender; grid.MasterTable.Columns.Add(tooltipColumn); StringBuilder sb = new StringBuilder(); StringWriter sw = new StringWriter(sb); HtmlTextWriter gridwriter = new HtmlTextWriter(sw); grid.RenderControl(gridwriter); Assert.AreEqual(grid.MasterTable.Columns.Primarykeys.Count, 2); Assert.AreEqual(grid.MasterTable.Columns.Primarykeys[0].Identity, false); Assert.AreEqual(grid.MasterTable.Columns.Primarykeys[1].Identity, false); Assert.Greater(grid.MasterTable.Rows.Count, 1); string content = sb.ToString(); string[] triggerStrings = new[] { "WebGrid Loading..", "show: { when: { event: 'dblclick'", "hide: { when: 'click',", "style: { name: 'green', width: 400, height: 300 },", "addClass(\"wgtooltipselected\"", "removeClass(\"wgtooltipselected\")", "$('#testtooltipColumnTP1').qtip", "$('#testtooltipColumnTP2').qtip", "$('#testtooltipColumnTP5').qtip" }; foreach (string part in triggerStrings) { int res = content.IndexOf(part); Assert.Greater(res, -1, part + Environment.NewLine + content); } }
internal override Column CopyTo(Column column) { if (column.ColumnType == ColumnType.Number) { ToolTipColumn c = (ToolTipColumn)base.CopyTo(column); c.BeforeToolTipRender = BeforeToolTipRender; c.HideMethod = HideMethod; c.ShowMethod = ShowMethod; c.ToolTipHeight = ToolTipHeight; c.ToolTipWidth = ToolTipWidth; c.Text = Text; c.ContentText = ContentText; c.ToolTipClientId = ToolTipClientId; c.CloseButtonText = CloseButtonText; return(c); } return(base.CopyTo(column)); }
internal override void CopyFrom(Column column) { base.CopyFrom(column); if (column.ColumnType != ColumnType.Number) { return; } ToolTipColumn c = (ToolTipColumn)column; BeforeToolTipRender = c.BeforeToolTipRender; HideMethod = c.HideMethod; ShowMethod = c.ShowMethod; ToolTipHeight = c.ToolTipHeight; ToolTipWidth = c.ToolTipWidth; ToolTipClientId = c.ToolTipClientId; ContentText = c.ContentText; Text = c.Text; CloseButtonText = c.CloseButtonText; }
internal static Column GetColumnFromType(string columnName, Table table, ColumnType columnType) { Column column; switch (columnType) { case ColumnType.Text: column = new Text(columnName, table); break; case ColumnType.Number: column = new Number(columnName, table); break; case ColumnType.Decimal: column = new Decimal(columnName, table); break; case ColumnType.Checkbox: column = new Checkbox(columnName, table); break; case ColumnType.DateTime: column = new DateTime(columnName, table); break; case ColumnType.Foreignkey: column = new Foreignkey(columnName, table); break; case ColumnType.ManyToMany: column = new ManyToMany(columnName, table); break; case ColumnType.GridColumn: column = new GridColumn(columnName, table); break; case ColumnType.Chart: column = new Chart(columnName, table); break; case ColumnType.File: column = new File(columnName, table) { IsInDataSource = false }; break; case ColumnType.Image: column = new Image(columnName, table) { IsInDataSource = false }; break; case ColumnType.ToolTip: column = new ToolTipColumn(columnName, table) { IsInDataSource = false }; break; case ColumnType.SystemColumn: column = new SystemColumn(columnName, Enums.SystemColumn.Undefined, table) { IsInDataSource = false }; break; default: column = new UnknownColumn(columnName, table); break; } return column; }
internal override Column Duplicate() { ToolTipColumn c = new ToolTipColumn(ColumnId, m_Table); CopyTo(c); return c; }