Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The reason why the <code>null</code> value gets added either at the top or bottom is because the sorting is on. if the sort is in <code>asc</code> the null value always will get added at the top. if the sort is in <code>desc</code>, it will get added at the bottom.</p> <p>For better understanding of this.. try this</p> <pre><code>&lt;fx:Script&gt; &lt;![CDATA[ import mx.collections.XMLListCollection; import mx.events.FlexEvent; [Bindable]protected var worklist:XMLListCollection; private var newvalue:int = 7; protected var xml:XML=&lt;items&gt; &lt;item&gt;&lt;value&gt;1&lt;/value&gt;&lt;/item&gt; &lt;item&gt;&lt;value&gt;2&lt;/value&gt;&lt;/item&gt; &lt;item&gt;&lt;value&gt;3&lt;/value&gt;&lt;/item&gt; &lt;item&gt;&lt;value&gt;4&lt;/value&gt;&lt;/item&gt; &lt;item&gt;&lt;value&gt;5&lt;/value&gt;&lt;/item&gt; &lt;item&gt;&lt;value&gt;6&lt;/value&gt;&lt;/item&gt; &lt;/items&gt;; protected function adg_creationCompleteHandler(event:FlexEvent):void { var list:XMLList=xml.item; worklist=new XMLListCollection(list); trace(worklist); } protected function createBut_clickHandler(event:MouseEvent):void { var xml:XML=&lt;item&gt;&lt;value&gt;{newvalue}&lt;/value&gt;&lt;/item&gt;; var selInd:int=adg.selectedIndex; var insertPos:int=selInd + 1; worklist.addItemAt(xml, insertPos); worklist.refresh(); newvalue++; } ]]&gt; &lt;/fx:Script&gt; </code></pre> <p>I have increased one numeric value every-time a new row is created.. 7,8,9 will get added at the top or bottom (depending on the sort). 10,11,12,.......... will get added previous or next (depending on the sort) to 1 as the value is considered as String.</p> <p>Note: The values internally are saved in the exact index location you wanted it to be.</p> <p><strong>Edit</strong></p> <p>Just change the Create Row Button click handler to</p> <pre><code>protected function createBut_clickHandler(event:MouseEvent):void { var xml:XML=&lt;item&gt;&lt;value&gt;{newvalue}&lt;/value&gt;&lt;/item&gt;; var selectedItem:Object = adg.selectedItem; worklist = new XMLListCollection(worklist.source); var selInd:int= worklist.getItemIndex(selectedItem); var insertPos:int=selInd + 1; worklist.addItemAt(xml, insertPos); worklist.refresh(); newvalue++; } </code></pre> <p>What is done here is.. When the sort(asc) is on, after the user has selected the row after which they want their entry to be and click on <code>Create Row</code>.. I will remove the sort and add the entry next to the selected value..</p> <p>If you want the sort to be on for the whole process, then it is literally tough.. at some point of time you will have to remove the sort to show the user where the data actually is..</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload