MultiSelect Select All - InfoPath Dev
in

InfoPath Dev

MultiSelect Select All

Last post 11-03-2008 07:12 AM by Dodge. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 10-31-2008 02:52 PM

    • Dodge
    • Not Ranked
      Male
    • Joined on 10-31-2008
    • Eden Prairie
    • Posts 4

    MultiSelect Select All

    Is there a way to enable MultiSelect Select All using the control for the InfoPath office client, not the web client (no javascript solution)?

  • 11-02-2008 04:01 PM In reply to

    Not in the control itself but you could have a check box beside it that the user could check. then have logic that if it is checked to interpret it as not filtering the list but showing everything.

  • 11-03-2008 06:27 AM In reply to

    • Dodge
    • Not Ranked
      Male
    • Joined on 10-31-2008
    • Eden Prairie
    • Posts 4

    I understand, and that is the approach I took initially, but when I look at the root xml to see what i have to work with from a MultiSelect, the only item available in the xml document is the checked item, if there is any.  There doesn't appear to be any items to iterate through to switch from 0 to 1 to indicate that they should be checked... or are you referring to doing this some other way?  Does anyone have an example of how they are doing this?  Seems like it would be a very common issue and frankly, I am surprised that it wasn't baked into the control to begin with.

  • 11-03-2008 06:34 AM In reply to

    You have not described what you are trying to do but usually if you are letting the user select a subset of data you are using a filter.  Unless you are using a web service InfoPath loads whole data sets.  So the options would be if checkbox is false then filter by drop down selection(s).  If checkbox is true, do not filter and show all values.

    If you explain what you are trying to accomplish in the form I might have a better response.

  • 11-03-2008 06:41 AM In reply to

    • Dodge
    • Not Ranked
      Male
    • Joined on 10-31-2008
    • Eden Prairie
    • Posts 4

    Very well, my situation is this:

    I have inserted a multiselect in an infopath form to populate with data from a datasource.  When the multiselect populates with data, the items that populate it are unchecked by default.  That is desired and no changes are necessary up to this point.  In some cases, the items can be numerous and it would be not be desireable to have the end user have to go through each item to select all.  Therefore, I created a button that one will push to select all or deselect all.  On the button click event, I obtain the multiselect node and iterate through each item.  When I do this, the only items I have to work with are selected items, if any items are selected.  If there are no items selected, there are no items in the node to iterate through.  How am I supposed to change the items checked value if I cannot iterate through the items?  Is that more clear?  Hope that helps...

  • 11-03-2008 06:53 AM In reply to

    I am not sure I am clear but I will give it a shot.  Is the data source a database?

    The multiselect is used as a query field?  I assume you have a short list of all the availabale item names or something and then use that to select items to retrieve details on.

    If you have no items in the multiselect then you would need to reset you data source back to original.  I am assuming this could be a query without any parameters or a parameter which does not return any values.

    You can also use a setfield action on a repeating data source and it will set the value on all rows.  So if you have a selection box in your data set then set that field true without a filter and it will set it for all rows.

  • 11-03-2008 07:12 AM In reply to

    • Dodge
    • Not Ranked
      Male
    • Joined on 10-31-2008
    • Eden Prairie
    • Posts 4

    That is correct, I am using a data source from a database.

    XmlNamespaceManager ns = this.NamespaceManager;
    XPathNavigator xn = this.MainDataSource.CreateNavigator();

    XPathNodeIterator xNodeSet = xn.Select(
    "/my:myFields/my:GroupAssignment/my:TheGroup/my:MultiSelectControl", ns);

    foreach (XPathNodeIterator xNode in xNodeSet)
    {
         xNode.Current.SetValue(
    "1");
    }

    The code above is how I am trying to accomplish this since there is no clear indication in the control how this would be accomplished otherwise.  When you run this code, only the selected items are present and accounted for to be manipulated.  Doesn't help.  How do you get at the items that are actually in the control, selected or not, so they can be selected or unselected using the above referenced code.  Or is there another way?

Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.