Ticket T699966
Visible to All Users

DataGrid - Filter DataSourceOptions option is not filled when the client "filter" method is called

created 6 years ago

Dear Support Team,

I am implementing one page where i have to use DevExtreme datagrid with checkbox selection of row.

I have gone through this url and implement it only the difference is i am not using external control to check check box based on dropdown selection used in this url.

Now the issue here is i need here if i change selection of any check box row then it should hit some event there i need the checked row column value.

I did some googled and found onRowClick and onSelectionChanged event both are working but the issue here is if i click any of the row cell at that time also this event is getting fired which i don't need here. I need the event should fire when user check any check box row.

Kindly suggest.

Thanks,

Veera

Answers approved by DevExpress Support

created 6 years ago

Hello,

I've checked your latest code snippet and see that the problem may occur because you call the "filter" method for the grid's instance instead of the DataSource instance of the target grid. In this scenario, you need to get the DataSource instance of the target grid by using the getDataSource method and filter this data source manually. For example:

JavaScript
var ds = $("#grid").dxDataGrid("instance").getDataSource(); ds.filter(['OrderID', '=', value]); ds.load();

Let us know if this recommendation helps.

    Show previous comments (6)
    DevExpress Support Team 6 years ago

      I am happy to hear that the issue has been resolved.

      LT LT
      Liju Thankachan 6 years ago

        Hi Maxim,

        One more issue related to the same scenario, Like when i click on first gridview row checkbox then it sends the selected code (CCount) and pass to the second grid action method where based on CCount value gets data from table and bind to the second grid. In this case CCount column is not present in second gridview and in this grid oncontentready event always getting totalcount 0 and second grid not loading.

        How could i fix this issue.

        I have attached one sample project where the same issue is reproduced.

        Kindly review and provide some suggestion.

        Thanks,

        Veera

        DevExpress Support Team 6 years ago

          Hi Veera,
          I've checked your scenario and concluded that the current issue is not directly related to the one we discussed in this ticket. Therefore, I've extracted your request into a separate thread - How to filter data with DataSourceLoadOptions on the server. Let's continue our discussion there.

          created 6 years ago (modified 6 years ago)

          Hi Team,
          For the above raised question i found a solution which is below:

          HTML
          .ShowCheckBoxesMode(GridSelectionShowCheckBoxesMode.Always)

          After using it when i click on checkbox only then selection changed event is firing if i click the row this event is not firing, Hence my issue is solved.
          Will let you know if i found any further issue related to the same.

          Thanks,
          Veera

            Comments (2)
            LT LT
            Liju Thankachan 6 years ago

              Hi Team,
              Now i have issue here like when user check any row checkbox then getting the specific column value in selectionchanged event i am getting the selected row specific column value and i have one more data grid there i need to pass this value like i did below:

              JavaScript
              function gridSelectionChanged(e) { var getSelectedData = e.selectedRowsData; var i, cptValue; for (i = 0; i < getSelectedData.length; i++) { if(i==0) cptValue = getSelectedData[i].CPT; else cptValue = cptValue + "," + getSelectedData[i].CPT; } if (cptValue != "" && cptValue != undefined) { var cptByPayordetailsGrid = $("#CPT_byPayorDetails").dxDataGrid("instance");//second grid cptByPayordetailsGrid.filter(["selectedCPTCode", cptValue]); cptByPayordetailsGrid.refresh(); } }

              As you can see in above code i am passing the value in second grid filter and refresh it.
              Below is my second gridview control:

              HTML
              @(Html.DevExtreme().DataGrid() .ID("CPT_byPayorDetails") .OnContentReady("CPT_byPayorDetailsContentReady") .ColumnAutoWidth(true) .ShowBorders(true).ShowRowLines(true).ShowColumnLines(true) .Columns(columns => { }).Paging(paging => paging.PageSize(20)) .Pager(pager => { pager.ShowPageSizeSelector(true); pager.AllowedPageSizes(new List<int> { 5, 10, 20 }); pager.ShowInfo(true); }).FilterRow(filterRow => filterRow .Visible(true) .ApplyFilter(GridApplyFilterMode.Auto) ).HeaderFilter(headerFilter => headerFilter.Visible(true)) .Grouping(grouping => grouping.AutoExpandAll(true)) .SearchPanel(searchPanel => searchPanel.Visible(false)) .GroupPanel(groupPanel => groupPanel.Visible(true)) .LoadPanel(a => a.ShowIndicator(false).ShowPane(false).Text(string.Empty)) .DataSource(d => d.Mvc().Controller("MYController").Key("CPT").LoadAction("ReportDetails")).DataSourceOptions(o => o.Filter("['selectedCPTCode', '']"))

              But when i am checking ReportDetails action method then found there DataSourceLoadOptions options.Filter value null.
              I need here the passed data to be get in this action method.
              Kindly suggest.

              Thanks,
              Veera

              LT LT
              Liju Thankachan 6 years ago

                Team,

                Any update on above?

                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.