Infragistics Home

Infragistics Forums

Infragistics community online discussions.
Welcome to Infragistics Forums Sign in | FAQ
in Search

Reordering columns messing up

Last post 07-25-2008 14:47 by [Infragistics] Curtis Taylor. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 07-17-2008 17:37

    • srozga
    • Top 100 Contributor
    • Joined on 04-09-2008
    • Points 550

    Reordering columns messing up

    I wrote some code that would allow me to reorder columns by dragging and dropping the LabelPresenters around. In a simple application it works flawlessly. However, in a more involved grid, I get a weird effect. When I drop a field onto another, it easily moves it and all. But when the grid redraws, most of my cells become blank; the values are just gone! The Cell.Value property is empty. The weirdest thing is that the fields for which values are missing are always the same, and, for the life of me, I can't find anything different about the fields that work. 

     The code that does the moving of the fields is:

                DragDropDataObject dataObj = e.Data.GetData(typeof(object)) as DragDropDataObject;
                if (dataObj == null) return;

                Field fieldDroppedOn = droppedOn.Field;
                Field droppedField = layout.Fields[dataObj.FieldName];


                if (droppedField == null || droppedOn == null) return;

                int fieldIndex = layout.Fields.IndexOf(fieldDroppedOn);
                layout.Fields.Remove(droppedField);
                layout.Fields.Insert(fieldIndex, droppedField);

     I am having a really hard time replicating this issu. Is there any limitations with removing/adding fields to the active field layout that I should be aware of?

     

    I have attached a screen shot of the blank cells.


    • Post Points: 20
  • 07-18-2008 4:22 In reply to

    • zhuwei
    • Not Ranked
    • Joined on 05-14-2008
    • Points 155

    Re: Reordering columns messing up

    Not sure if it helps, I've got the column move working perfectly with similar code to yours, except i used layout.Fields.Move rather than remove and insert.

    • Post Points: 20
  • 07-22-2008 12:06 In reply to

    • srozga
    • Top 100 Contributor
    • Joined on 04-09-2008
    • Points 550

    Re: Reordering columns messing up

     It's good to know that this method exists, but it doesn't help unfortunately.

    • Post Points: 5
  • 07-25-2008 11:40 In reply to

    • srozga
    • Top 100 Contributor
    • Joined on 04-09-2008
    • Points 550

    Re: Reordering columns messing up

    We solved this issue. It turns out that the problem was that if my field layout defined both Field and UnboundField fields, only the UnboundField objects would retain their data and the cells corresponding to Field didn't. Sounds like a pretty bad bug.

    But, if all the fields are either Field or all are UnboundField, reordering works perfectly. So we changed all our fields to UnboundField and set the BindingPath == Name and it works.

    • Post Points: 20
  • 07-25-2008 12:00 In reply to

    • zhuwei
    • Not Ranked
    • Joined on 05-14-2008
    • Points 155

    Re: Reordering columns messing up

    wow, it's great to know about this, thanks for the post back. Hope they will get fixed in future releases.

    • Post Points: 20
  • 07-25-2008 14:47 In reply to

    Re: Reordering columns messing up

    Thanks for posting this functionality. It looks really useful. Feel free to report things that do not work at our developer support page. The best way to ensure something gets fixed is to report it.

    http://devcenter.infragistics.com/Protected/SubmitSupportIssue.aspx

    Thank you!

    Curtis Taylor
    Senior Consultant
    Infragistics, Inc.
    • Post Points: 5
Page 1 of 1 (6 items)
Powered by Community Server (Commercial Edition), by Telligent Systems