[CLOSED] MultiCombo

Page 1 of 3 123 LastLast
  1. #1

    [CLOSED] MultiCombo

    Hi,

    I'm older version I used this:

    multiCombo.getText()
    Is this equivalent right now? Or there is any other method or property to use it?
    multiCombo.rawValue
    In the same way, if I have something like this example
    <ext:MultiCombo ID="cmbTest" runat="server" Width="200" FieldLabel="Sample" LabelAlign="Top">
            <Items>
                <ext:ListItem Text="Text 1" Value="1" />
                <ext:ListItem Text="Text 2" Value="2" />
                <ext:ListItem Text="Text 3" Value="3" />
                <ext:ListItem Text="Text 4" Value="4" />
            </Items>        
        </ext:MultiCombo>
    If I selected the items in thsi order 4,2,3,1 control shows me in the order I selected (Text 4, Text 2, Text 3, Text 1) instead of in order marked in list/store (Text 1, Text 2, Text 3, Text 4)
    Last edited by Daniil; Aug 02, 2012 at 12:01 PM. Reason: [CLOSED]
  2. #2
    Hi,

    I can suggest the following solution.
    var combo = App.MultiCombo1,
        value = combo.getRawValue(),
        sortedValue = value.split(combo.delimiter).sort().join();
  3. #3
    Hi,

    With this I have the value sorted well but I meant that in input field of multicombo appears unordered instead of appear ordered like in v1.x

    This would be fixed in v2.1? Or you doesn't consider a bug?
  4. #4
    Related with my other post http://forums.ext.net/showthread.php...ion-via-script

    I tried to use with revision 4239

    multiCombo.setValue(['1', '2']);
    And not works, it show 1,2 in input field instead of text that correspond. And also doesn't check any item.

    In the same way, I'm trying to load multicombo value with FormPanel.form.loadRecord(record) and record data has a property that corresponds with multicombo and the result is the same.

    Could you provide me the format that multicombo expect in setValue and/or loadRecord of the form?
  5. #5
    Quote Originally Posted by softmachine2011 View Post
    With this I have the value sorted well but I meant that in input field of multicombo appears unordered instead of appear ordered like in v1.x

    This would be fixed in v2.1? Or you doesn't consider a bug?
    Got it. Well, I would prefer to don't consider it a bug. Just the change in the behavior. Personally, I like the new behavior more.

    Though, sure, it has been changed since Ext.NET v1 and can annoy.

    Probably, it would be best to have an option to get the two behaviors switching that option.

    For now, I can suggest the following solution. Though I am not 100% sure it won't cause any background effect, but almost sure.

    Example
    Ext.form.field.ComboBox.override({
        onListSelectionChange: function(list, selectedRecords) {
            var me = this,
                isMulti = me.multiSelect,
                hasRecords = selectedRecords.length > 0;
    
            /* Workaround */
            Ext.Array.sort(selectedRecords, function (r1, r2) {
                return r1.get(me.displayField) > r2.get(me.displayField)
            });
            /* End of Workaround */
    
            // Only react to selection if it is not called from setValue, and if our list is
            // expanded (ignores changes to the selection model triggered elsewhere)
            if (!me.ignoreSelection && me.isExpanded) {
                if (!isMulti) {
                    Ext.defer(me.collapse, 1, me);
                }
                /*
                    * Only set the value here if we're in multi selection mode or we have
                    * a selection. Otherwise setValue will be called with an empty value
                    * which will cause the change event to fire twice.
                    */
                if (isMulti || hasRecords) {
                    me.setValue(selectedRecords, false);
                }
                if (hasRecords) {
                    me.fireEvent('select', me, selectedRecords);
                }
                me.inputEl.focus();
            }
        }
    });
    Quote Originally Posted by softmachine2011 View Post
    Related with my other post http://forums.ext.net/showthread.php...ion-via-script

    I tried to use with revision 4239

    multiCombo.setValue(['1', '2']);
    And not works, it show 1,2 in input field instead of text that correspond. And also doesn't check any item.
    I just tested the example in that thread, it appears to be working correctly. Did you test with that example? If no, please provide a new one.
  6. #6
    Quote Originally Posted by Daniil View Post
    Got it. Well, I would prefer to don't consider it a bug. Just the change in the behavior. Personally, I like the new behavior more.

    Though, sure, it has been changed since Ext.NET v1 and can annoy.

    Probably, it would be best to have an option to get the two behaviors switching that option.
    .
    It would be this option in a future v2.1 of Ext.NET?



    Quote Originally Posted by Daniil View Post
    I just tested the example in that thread, it appears to be working correctly. Did you test with that example? If no, please provide a new one.
    Hi,

    It seems that don't work with items loaded by an store, here is an example

    <script runat="server">
            protected void Page_Load(object sender, EventArgs e)
            {
                this.Store1.DataSource = new object[]
            {
                new object[]{1,"AL", "Alabama", "The Heart of Dixie", 5.99},
                new object[] {2, "AK", "Alaska", "The Land of the Midnight Sun", 5.99},
                new object[] {3, "AZ", "Arizona", "The Grand Canyon State", 5.99},
                new object[] {4, "AR", "Arkansas", "The Natural State", 5.99}
            };
    
                this.Store1.DataBind();
            }
        </script>
    
                <ext:MultiCombo ID="cmbTest" runat="server" Width="200" FieldLabel="Sample" LabelAlign="Top" ValueField="id" DisplayField="state">
                    <Store>
                        <ext:Store ID="Store1" runat="server">
                            <Model>
                                <ext:Model runat="server" IDProperty="id">
                                    <Fields>
                                        <ext:ModelField Name="id" Type="Int" />
                                        <ext:ModelField Name="abbr" Type="String" />
                                        <ext:ModelField Name="state" Type="String" />
                                        <ext:ModelField Name="nick" Type="String" />
                                        <ext:ModelField Name="price" Type="Float" />
                                    </Fields>
                                </ext:Model>
                            </Model>
                        </ext:Store>
                    </Store>
                </ext:MultiCombo>
                <ext:Button runat="server">
                    <Listeners>
                        <Click Handler="cmbTest.setValue(['1', '2']);" />
                    </Listeners>
                </ext:Button>
  7. #7
    Quote Originally Posted by softmachine2011 View Post
    It would be this option in a future v2.1 of Ext.NET?
    I don't know yet it will be or not. I will notify you.


    Quote Originally Posted by softmachine2011 View Post
    It seems that don't work with items loaded by an store, here is an example

    <script runat="server">
            protected void Page_Load(object sender, EventArgs e)
            {
                this.Store1.DataSource = new object[]
            {
                new object[]{1,"AL", "Alabama", "The Heart of Dixie", 5.99},
                new object[] {2, "AK", "Alaska", "The Land of the Midnight Sun", 5.99},
                new object[] {3, "AZ", "Arizona", "The Grand Canyon State", 5.99},
                new object[] {4, "AR", "Arkansas", "The Natural State", 5.99}
            };
    
                this.Store1.DataBind();
            }
        </script>
    
                <ext:MultiCombo ID="cmbTest" runat="server" Width="200"  FieldLabel="Sample" LabelAlign="Top" ValueField="id"  DisplayField="state">
                    <Store>
                        <ext:Store ID="Store1" runat="server">
                            <Model>
                                <ext:Model runat="server" IDProperty="id">
                                    <Fields>
                                        <ext:ModelField Name="id" Type="Int" />
                                        <ext:ModelField Name="abbr" Type="String" />
                                        <ext:ModelField Name="state" Type="String" />
                                        <ext:ModelField Name="nick" Type="String" />
                                        <ext:ModelField Name="price" Type="Float" />
                                    </Fields>
                                </ext:Model>
                            </Model>
                        </ext:Store>
                    </Store>
                </ext:MultiCombo>
                <ext:Button runat="server">
                    <Listeners>
                        <Click Handler="cmbTest.setValue(['1', '2']);" />
                    </Listeners>
                </ext:Button>
    You bind numbers into the Store, so, you should use numbers, not strings, in the setValue method as well.
    Last edited by Daniil; Aug 01, 2012 at 12:35 PM.
  8. #8
    We have added the SortByDisplayField property. True to sort selected items by DisplayField. Defaults to false.

    SVN revision #4240 (2.1 branch).

    Thanks for the report.
  9. #9
    Quote Originally Posted by Daniil View Post
    You bind numbers into the Store, so, you should use numbers, not strings, in the setValue method as well.
    Ok thanks, it works setValue without quotes.


    Quote Originally Posted by Daniil View Post
    We have added the SortByDisplayField property. True to sort selected items by DisplayField. Defaults to false.

    SVN revision #4240 (2.1 branch).

    Thanks for the report.
    Thanks for it, I'll update to it.
  10. #10
    I try rev 4240 but new property doesn't apply.

    In changes I didn't appreciate when the override or call to new function is do it. It could miss this in source?
Page 1 of 3 123 LastLast

Similar Threads

  1. [CLOSED] Multicombo with a lot of items
    By sadaf in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Oct 20, 2011, 1:32 PM
  2. [CLOSED] Multicombo in Sharepoint
    By sadaf in forum 1.x Legacy Premium Help
    Replies: 12
    Last Post: Oct 17, 2011, 1:11 PM
  3. [CLOSED] MultiCombo in version 0.8.x
    By FpNetWorth in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 14, 2011, 6:13 PM
  4. [CLOSED] Multicombo in RowEditor
    By vali1993 in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Oct 14, 2010, 9:00 PM
  5. [CLOSED] MultiCombo Error
    By rthiney in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 26, 2010, 4:05 PM

Tags for this Thread

Posting Permissions