Ticket T211806
Visible to All Users

dxDataGrid - How to implement the master-detail search panel

created 10 years ago

[DevExpress Support Team: CLONED FROM T211119: dxDataGrid does not insert data properly in IE11]
Follow up question: Issue 3:
If I add a search panel on the master grid, it only searches items in the master columns. Ideally it would be nice to find all HIGH priority items across all employees. i.e I want to the search to include the details data.  Is it possible to do that?
Given that the data source itself contains the details about tasks - it would be awesome if the search panel could include the data from the details, expand all master rows that had high priority items and highlight the high priority items.

Show previous comments (3)

    I'll try to put something together - will need a couple days to knock out some other items before I get to this.

    DevExpress Support Team 10 years ago

      I'm looking forward to hearing from you.

        I am going to try to describe the scenario. It is specific to master/detail views. I have attached a screen shot for the described search function enhancement in master/detail mode.
        Say we have a couple thousand users and each has associated tasks. The master grid displays the users. When a user row is expanded the details grid shows the tasks associated with that user.
        How would I show all users that have high priority tasks pending?
        The issue that I believe I am running into is that the "search" and "filter" capabilities rely on master grid rows. The feature that I am looking for is the ability to search the master rows - based on the details properties.
        Could the search/filter capability be extended to allow specifying searching of nested properties?
        If the model has each master and associated detail information like below
        Customer { //master
          prop1: " ",
          prop2: " ",
         Tasks: [
                    detailsProp1: " ",
                    detailsProp2: " ",
                   ]
        }
        Being able to specify that Tasks.detailsProp1 should be included in the search or that Task.* (all properties on Tasks items) should be included in search would allow extracting useful information in the master/detail use cases.
        If such a nested match is identified the entire master row should be expanded in the search result. ( highlighting the search term in the details would require knowledge of details template grid and that might be trickier)
        In the http://jsfiddle.net/ycgw08j5/ example - searching for "High" could look at the employee.Tasks.Priority and show all master employee rows that have "High" priority tasks.
        The filtering option would allow users to specify more.  Say that find master rows where Tasks.Priority="High"  and Tasks.Status="Incomplete".
        Again here we are enhancing the master grid filtering capabilities to include extra properties that are either nested, or don't appear in the grid or are on a collection on the master row.

        Answers

        created 10 years ago (modified 5 years ago)

        Tejal,

        Updated:

        As a possible approach, you can do the following:

        1. Place a TextBox to perform this search. I recommend placing it in the DataGrid's toolbar using the onToolbarPreparing event.
        2. When a user performs search, you can filter the required grids using either their DataGrid.filter method or set the search text to the searchPanel.text option.

        In the case wherein you will need to apply the current search value to collapsed rows that are opened, see the onRowExpanded event for this purpose.

        Previous versions:

        The dxDataGrid search panel does not support searching for data in options that are not used as data fields for your dxDataGrid. A possible solution is to implement the searching manually. For example:

        1. Place dxTextBox near your grid.
        2. In the dxTextBox.onValueChanged event handler, get the current text box value and loop through your items by comparing options of each item with the text box value.
        3. If you find matches in options that are associated with detail grid data, call the dxDataGrid.expandRow method of the master grid and pass a corresponding key value to it.
        4. In the dxDataGrid.onCellPrepared event handler of the detail grid, compare the value argument with the searched value. If they are equal, highlight this cell by applying a CSS rule to a cell. Use the cellElement argument for this.
          Comments (3)
          RS RS
          Randeep Singh 1 5 years ago

            @DevExpress team, appreciate if you can provide working example here on how to search across Master and Detail rows (either collapse or expanded)

            DevExpress Support Team 5 years ago

              Hello,

              I've created a separate ticket on your behalf (T873879: DataGrid - How to search across the master and detail rows). It has been placed in our processing queue and will be answered shortly.

                Please remove me from this thread. Thanks

                David Karasek

                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.