Ticket Q498407
Visible to All Users

GridView - Custom Binding - The GetSelectedFieldValues method returns values from the current page only

created 12 years ago

I will show an error on your examples.

  1. Open page http://mvc.devexpress.com/GridView/RowSelection
    In developer console call next methods:
JavaScript
gvRowSelection.SelectRows() gvRowSelection.GetSelectedFieldValues("ContactName",function(keys){alert(keys.length);})

You see the number equal to the number of rows in a table (not the number of rows in one page) - it's good.
 2) Open page http://mvc.devexpress.com/GridView/SimpleCustomBinding
 In developer console call next methods:

JavaScript
gridView.SelectRows() gridView.GetSelectedFieldValues("From",function(keys){alert(keys.length);}

Instead of the number of rows in the table, you will see the number of rows on a page - it's a bug.My grid uses Custom binding. After calling selectRows() I want to get the keys for all of the selected rows in a table. But I am getting a list of keys the current page only.

Comments (2)

    Hello Pavel,
    Thank you for contacting us. We need some additional time to review this scenario to provide you with a precise answer.
    We appreciate your patience while we are working on finding a solution to your inquiry.

    Anthony (DevExpress Support) 12 years ago

      Hello,
      I have reproduced this issue and forwarded it to our R&D team for further investigation.

      Answers approved by DevExpress Support

      created 12 years ago (modified 12 years ago)

      Pavel,
      We have investigated this issue. This behavior is by design. When custom binding is used, the grid receives the information about the current page only. Thus, I suggest you the following:
      Manually serialize selected rows (their indexes or keys based on your task). Then, when it is necessary to obtain the data, send a callback to the server, parse your own selection state and obtain the required data.

        Comments (2)

          It is a very strange behavior. I'd like to draw your attention to the fact that if I add a command column to the Grid with custom binding and set its ShowSelectCheckBox property to true and then manually select some rows on different pages GetSelectedFieldValues() works correctly - the values returned for all selected records. The problem only with the method SelectRows(). Make sure that this is the way it supposed to be. If this behavior is by design, can you suggest concrete solution? What should I do after the call SelectRows() to get the keys of all the selected records on the client-side?

          DevExpress Support Team 12 years ago

            Hello Pavel,
            GridView stores selected keys in a separate list. Thus you can get this list via the GetSelectedFieldValues method even for invisible rows.
            If you want to select rows that are invisible on the current page, add the grid's selected keys via the MVCxGridView.Selection.SelectRowByKey or the MVCxClientGridView.SelectRowsByKey methods. Please refer to the GridView - Select all items when filter is applied selects only current page items thread for more information.

            Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

            Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.