Multi Select select/deselect

  1. #1

    Multi Select select/deselect


    Hi....
    I am using multisilect
    as

    
    
    
    
    <ext:Window ID="winDisplayAmount" Border="false" runat="server" MinWidth="140px"
    
    
    Width="140px" TitleCollapse="true" Height="220px" Resizable="false" Header="false"
    
    
    ShowOnLoad="false" Closable="false" BodyBorder="false" Frame="false" HideBorders="true"
    
    
    CenterOnLoad="false" Draggable="False" AutoScroll="True">
    
    
    <Body>
    
    
    <ext:MultiSelect ID="multiDisplayAmount" runat="server" HideParent="true" Height="1020px"
    
    
    Width="110px" ValueField="Value" DisplayField="Text" StoreID="storeFaceAmount"
    
    
    MultiSelect="true">
    
    
    <Listeners>
    
    
    <Click Handler="setSelectedItemsInField(#{multiDisplayAmount}, #{trgfieldDisplayAmount}, #{multiVSSClass});" />
    
    
    </Listeners>
    
    
    </ext:MultiSelect>
    
    
    </Body>
    
    
    <BottomBar>
    
    
    <ext:Toolbar ID="amountBottomBar" runat="server">
    
    
    <Items>
    
    
    <ext:ToolbarButton ID="amountBottomBarBtn" MinWidth="120px" Width="120px" runat="server"
    
    
    Text="Done" MenuAlign="center" OnClientClick="#{winDisplayAmount}.hide();">
    
    
    </ext:ToolbarButton>
    
    
    </Items>
    
    
    </ext:Toolbar>
    
    
    </BottomBar>
    
    
    </ext:Window>
    The selection is conditional.....

    as....

    
    
    
    
    var setSelectedItemsInField = function(multiselect1, triggerField, multiselect2)
    
    
    {
    
    
    var selectedIDs = "";
    
    
    var countSelectedItems = multiselect1.view.selected.elements.length;
    
    
    if(typeof(countSelectedItems) == "undefined")
    
    
    {
    
    
    countSelectedItems = 0;
    
    
    }
    
    
    var selectedCount2 = multiselect2.view.selected.elements.length;
    
    
    if(typeof(selectedCount2) == "undefined")
    
    
    {
    
    
    selectedCount2 = 0;
    
    
    } 
    
    
    
    
    
    if(countSelectedItems > 0)
    
    
    {
    
    
    
    
    
    if(selectedCount2 > 1 &amp;&amp; countSelectedItems > 2)
    
    
    {
    
    
    multiselect1.view.deselect(multiselect1.view.lastSelection);
    
    
    return false;
    
    
    }
    
    
    if(selectedCount2 > 2 &amp;&amp; countSelectedItems > 1)
    
    
    {
    
    
    multiselect1.view.deselect(multiselect1.view.lastSelection);
    
    
    return false;
    
    
    } 
    
    
    else if(selectedCount2 < 2 &amp;&amp; countSelectedItems > 4)
    
    
    {
    
    
    multiselect1.view.deselect(multiselect1.view.lastSelection);
    
    
    return false;
    
    
    }
    
    
    
    
    
    }
    
    
    }

    when condition become false the selected item is deselected....

    its showing fine in UI....
    but on post back cs page , its getting one extra selection(last deselected item)....please help me to eliminate this...
  2. #2

    RE: Multi Select select/deselect

    Hi,

    Don't use 'view.deselect'.


    Use setValue/setValueByIndex. Get values (getValue, getIndexes), exclude required value and call setValue
    Vladimir Shcheglov
    Sr. Developer
  3. #3

    RE: Multi Select select/deselect

    Thanx a lot...
    it worked perfectly.

Similar Threads

  1. Replies: 2
    Last Post: Jul 29, 2010, 7:28 PM
  2. multi select and top label
    By [WP]joju in forum 1.x Help
    Replies: 2
    Last Post: Sep 10, 2009, 3:01 AM
  3. Multi Select - JIT
    By amitpareek in forum Open Discussions
    Replies: 1
    Last Post: Dec 09, 2008, 10:31 AM
  4. [FUTURE] [V0.8] Multi select, combobox
    By Jurke in forum Feature Requests
    Replies: 6
    Last Post: Dec 04, 2008, 10:44 AM
  5. ext multi select
    By [WP]joju in forum 1.x Help
    Replies: 2
    Last Post: Dec 03, 2008, 11:09 AM

Posting Permissions