We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Goto Row

Hi,

i am looking for some samples or orientations on how to do this

suppose that i have a sfdatagrid bound to some collection and a textbox for serach input .
what i want when the user start typing in the input textbox, is that the datagrid scroll to show the record the user is searching for instead of filtering the collection

any help or idea is welcome .

thanks

6 Replies

IS issam April 11, 2016 01:11 PM UTC

also an example on how to calculate footer sums only for checked rows would be great .

thanks again .


JS Jayapradha S Syncfusion Team April 12, 2016 12:17 PM UTC

Hi Issam,

Thank you for contacting Syncfusion Support.

We have analyzed your query and please find the details below,


Regarding query: what i want when the user start typing in the input textbox, is that the datagrid scroll to show the record the user is searching for instead of filtering the collection

You can search and view the filtered record by scrolling the datagrid with the help of SearchHelper.Search method and by passing the corresponding search text row index to ScrollInview method like below,

  private void searchTextBox_TextChanged(object sender, TextChangedEventArgs e)

    {

        RowColumnIndex rowColumnIndex = new RowColumnIndex();

        text = (e.Source as TextBox).Text.ToLower();

        this.datagrid.SearchHelper.Search(text);

        datagrid.SearchHelper.FindNext(text);

        rowColumnIndex.RowIndex = this.datagrid.SearchHelper.CurrentRowColumnIndex.RowIndex;             

        datagrid.ScrollInView(rowColumnIndex);       
    }


Regarding query:  an example on how to calculate footer sums only for checked rows would be great .

You can calculate the sum values based on IsChecked value of CheckBox column by implementing ISummaryAggregate and ISummaryAggregate.CalculateAggregateFunc() as shown below,

public class CustomAggregate : ISummaryAggregate

    {

        public CustomAggregate()

        {

        }

        public double Checked { get; set; }


        Action<IEnumerable, string, PropertyDescriptor> ISummaryAggregate.CalculateAggregateFunc()

        {

            return (items, property, pd) =>

            {

                var enumerableItems = items as IEnumerable<BusinessObjects>;

                enumerableItems = enumerableItems.Where(x => x.IsChecked).ToArray();

                if (pd.Name == "Checked")

                {

                    this.Checked = enumerableItems.StdDev<BusinessObjects>(bo => bo.Salary);

                }

            };


        }


    }

  public static double StdDev<T>(this IEnumerable<T> values, Func<T, double> selector)

        {

            double assignedpercent = 0;

            var count = values.Count();


            if (count > 0)

            {

                assignedpercent = values.Sum(selector);

            }

            return assignedpercent;
        }

<Syncfusion:SfDataGrid.TableSummaryRows>

  <Syncfusion:GridTableSummaryRow Position="Bottom" ShowSummaryInRow="False">

                    <Syncfusion:GridTableSummaryRow.SummaryColumns>

                        <Syncfusion:GridSummaryColumn Name="groupSummary"

                                                      CustomAggregate="{StaticResource customAggregate}"

                                                      Format="'{Checked:n}'"

                                                      MappingName="IsChecked"

                                                      SummaryType="Custom" />

                    </Syncfusion:GridTableSummaryRow.SummaryColumns>

  </Syncfusion:GridTableSummaryRow>
</Syncfusion:SfDataGrid.TableSummaryRows>

 
Please find the sample from the following location,

Sample Link: http://www.syncfusion.com/downloads/support/forum/123685/ze/CustomSummaryWithSearchPanel-1339424758


Regards,
Jayapradha



IS issam April 12, 2016 03:01 PM UTC

hi and thanks, still need some help here :)

Query1
i cannot find the "SearchHelper" method in the provided  sample, so any implementation example would be helpful .

Query2
i have made this little example based on your previous sample, please see the attached file .
as you can see , i have 2 aggregate columns, what i want is to display the summaries under each respective column, with the ability to check/uncheck rows and calculate like previous .

Query3
here the senario :
i want to add a column with an action button on each row .
 
when the user click on it, pop up  a window or something to select a client . then the active row become child of the selected client .

imagine that tomorrow microsoft buy apple :p, so i click on apple and select microsoft from a separate list.
 the the apple row become child of Microsoft one,.
also the amount of totalorders/totaltva columns have to be added to microsoft ,so it become ; 6000 and 1020
with the ability to see apple details row and all corresponding columns and i can check/unchcheck too like regular row

my concern here is , should i implement this as grouping or  master/details
any idea on how to do this is welcome

Attachment: testUpload_aae85d6f.zip


JS Jayapradha S Syncfusion Team April 14, 2016 03:55 AM UTC

Hi Issam,

Please find the below responses.

Query 1:
We have provided the support for SearchHelper from release version 13.4.0.53. You can access this SearchHelper from 13.4 and later versions.

Query 2: We don’t have a direct support to achieve this . We are currently checking on renderer to achieve your requirement.

Query 3: You can add a new child record by clicking on a button in parent row   by using Details View concept. We have prepared a sample for your requirement and please find the sample from the following location,

Sample Link:
http://www.syncfusion.com/downloads/support/forum/123685/ze/testUpload-435731457

Regards,
Jayapradha



IS issam April 16, 2016 05:06 AM UTC

Hi,

i was able to solve all my issues by adapting your samples and cheating a liitle ;)

thanks a lot for your help :)

really appreciate .


JS Jayapradha S Syncfusion Team April 18, 2016 04:29 AM UTC

Hi Issam,

Thank you for your update.

We are glad to know that you requirement has been met.

Please let us know if you require any other assistance.

Regards,
Jayapradha


Loader.
Live Chat Icon For mobile
Up arrow icon