您好,由于时间关系,我这里简单实现了下您的需求,具体细节您还需要修改下。
- TestWebControlInCell usercontrol = new TestWebControlInCell();
- usercontrol.SpreadClientID = FpSpread1.ClientID;
复制代码- [Serializable]
- public class TestWebControlInCell : FarPoint.Web.Spread.GeneralCellType
- {
- public string SpreadClientID { get; set; }
- public override Control GetEditorControl(string id, TableCell parent, FarPoint.Web.Spread.Appearance style, FarPoint.Web.Spread.Inset margin, object value, bool upperLevel)
- {
- Table table = new Table();
- table.CellPadding = 0;
- table.CellSpacing = 0;
- table.BorderStyle = BorderStyle.None;
- table.BorderWidth = new Unit(0, UnitType.Pixel);
- table.Width = new Unit(100, UnitType.Percentage);
- TableRow row = new TableRow();
- TableCell cell = new TableCell();
- cell.VerticalAlign = VerticalAlign.Middle;
- cell.HorizontalAlign = HorizontalAlign.Left;
-
- OrgCommBox buc = (OrgCommBox)parent.Page.LoadControl("OrgCommBox.ascx");
- buc.SpreadClientID = this.SpreadClientID;
- //buc.ID = "NewID" + parent.ID;
- cell.Controls.Add(buc);
- row.Cells.Add(cell);
- table.Rows.Add(row);
- return table;
- }
- }
复制代码
- <script>
- $(function () {
- var activeRow, activeCol;
- var mutipSel = $('#ms').change(function () {
- // console.log($(this).val());
- }).multipleSelect({
- width: '100%',
- onClose: function () {
- var spread = document.getElementById("<%=SpreadClientID %>");
- var texts = mutipSel.data('multipleSelect').getSelects("text")
- spread.Cells(activeRow, activeCol).SetValue(texts);
- console.log($('#ms').val());
- },
- onOpen: function () {
- var spread = document.getElementById("<%=SpreadClientID %>");
- activeRow = spread.ActiveRow;
- activeCol = spread.ActiveCol;
- var values = spread.GetValue(activeRow, activeRow).split(",");
- // var texts = mutipSel.data('multipleSelect').setSelects(values)
-
- }
- });
- });
- </script>
复制代码
|