How to focus the updated record after refreshing a Syncfusion GridSyncfusion Grid Grouping Control Extendhow to load template for add or edit record in for syncfusion grid in partial viewsyncfusion Grid is not displayed on screenSyncfusion : How to install only Grid component from Syncfusion for Angularsyncfusion ej grid javascript methodSyncfusion mvc grid control filtering on hyperlink columnSyncfusion Angular Grid - delete selected rowHow to add tooltips to command buttons in a Syncfusion Grid for AngularHow to hide grid spinner in syncfusion Grid componentHow to expand a cell in a Syncfusion Angular Grid?

Is "I do not want you to go nowhere" a case of "DOUBLE-NEGATIVES" as claimed by Grammarly?

Does the Pole of Angling's command word require an action?

Why weren't bootable game disks ever common on the IBM PC?

Why was hardware diversification an asset for the IBM PC ecosystem?

Indesign - how to change the style of the page numbers?

How can I get a player to accept that they should stop trying to pull stunts without thinking them through first?

Why didn't Thanos kill all the Dwarves on Nidavellir?

OR-backed serious games

Why return a static pointer instead of an out parameter?

Single word for "refusing to move to next activity unless present one is completed."

Is it OK to leave real names & info visible in business card portfolio?

Sharing shapefile collection

How would vampires avoid contracting diseases?

How were Martello towers supposed to work?

Fast validation of time windows in a routing problem

What's the point of having a RAID 1 configuration over incremental backups to a secondary drive?

Is "De qui parles-tu" (for example) as formal as it is in English, or is it normal for the French to casually say that

String manipulation with std::adjacent_find

What happened to people in unsafe areas during the Blip?

LED glows slightly during soldering

Why does this potentiometer in an op-amp feedback path cause noise when adjusted?

Why isn't pressure filtration popular compared to vacuum filtration?

Why would non-kinetic weapons be used for orbital bombardment?

How to say "How long have you had this dream?"



How to focus the updated record after refreshing a Syncfusion Grid


Syncfusion Grid Grouping Control Extendhow to load template for add or edit record in for syncfusion grid in partial viewsyncfusion Grid is not displayed on screenSyncfusion : How to install only Grid component from Syncfusion for Angularsyncfusion ej grid javascript methodSyncfusion mvc grid control filtering on hyperlink columnSyncfusion Angular Grid - delete selected rowHow to add tooltips to command buttons in a Syncfusion Grid for AngularHow to hide grid spinner in syncfusion Grid componentHow to expand a cell in a Syncfusion Angular Grid?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have been using a Syncfusion grid in my angular (v.6.0.8) project. In one of the pages, users can mark months as completed by checkboxes.



It causes to some of the status changes in the model. Hence, I update the model using "splice", after the backend call is completed. In order to reflect the changes on the grid, I have to call this.deliveryItemsGrid.refresh(); but, this cause to lose the position where the user is working on (grid scrolls up to the top).



Is there a way that I could use to refresh the grid without changing the scroll bar position?



[HTML]



 <!-- JAN -->
<e-column headerText="JAN" [customAttributes]="class: 'textAlignment'">
<ng-template #template let-data>
<div> <i class="fa fa-wrench fa-2x" [style.color]="getMonthColorRM(data, 0)"></i></div>
<div *ngIf="!isReadOnlyUser" class="custom-control custom-checkbox">
<input id="chkChangeStatusRMdata.rmDetailId + 'JAN'" type="checkbox" class="custom-control-input"
[checked]="getMonthCompletionStatus(data, 0)" (change)="saveStatusRM(data,'0')" aria-label="Complete Task" />
<label *ngIf="getMonthCompletionStatus(data, 0)" class="custom-control-label rm-month" for="chkChangeStatusRMdata.rmDetailId + 'JAN'" data-toggle="tooltip" data-placement="top" title="Mark as not complete"></label>
<label *ngIf="!getMonthCompletionStatus(data, 0)" class="custom-control-label rm-month" for="chkChangeStatusRMdata.rmDetailId + 'JAN'" data-toggle="tooltip" data-placement="top" title="Mark as complete"></label>
</div>
<div *ngIf="data.type != 'RM' && ((data?.plannedDate?.getMonth()) == 0)"> <i id="'JAN'+ data.type + data.id" class="fa fa-wrench fa-2x" [style.color]="getMonthColorCM(data)"></i></div>
</ng-template>
</e-column>


[ts file]



private saveStatusRM(row: DeliveryPlanModel, monthId) 
if (row && row.rmYears)
let selectedRmYear: IYearModel = row.rmYears.filter(y => y.year == this.selectedYear.toString())[0];
selectedRmYear.schoolNumber = this.schoolNumber;
selectedRmYear.completedMonthsList.filter(m => m.month == monthId)[0].completed = !selectedRmYear.completedMonthsList.filter(m => m.month == monthId)[0].completed;
selectedRmYear.completed = selectedRmYear.completedMonthsList.every(m => m.completed);

if (selectedRmYear.completed)
row.statusDisplay = "Completed";
else
if (selectedRmYear.completedMonthsList.some(m => m.completed))
row.statusDisplay = "In progress";
else
row.statusDisplay = "Planned";


// Set the color of the spanners (This is only for front-end use)
selectedRmYear.completedMonthsList.forEach(x =>
let color: string = "";
if (x.completed)
color = "green";

else
let dueOn: Date = new Date(+selectedRmYear.year, +x.month + 1, 1);
let currentDate: Date = new Date();
color = currentDate < dueOn ? "black" : "red";

x.color = color;
)
// Update the record on the Database.
this.deliveryPlanService.updateStatusRM(selectedRmYear).subscribe(
data =>
if (data)
// Replace the updated record in 'gridRows'
var selectedRow = this.gridRows.filter(x => x.rmDetailId == row.rmDetailId)[0]
var selectedRecordIndex = this.gridRows.indexOf(selectedRow);
this.gridRows.splice(selectedRecordIndex, 1, row);
this.calculateRmProgress(this.gridRows);
//this.deliveryItemsGrid.refresh();

);




private getMonthCompletionStatus(row: DeliveryPlanModel, monthId): boolean
if (row && row.rmYears)
let selectedRmYear: IYearModel = row.rmYears.filter(y => y.year == this.selectedYear.toString())[0];
if (selectedRmYear && selectedRmYear.completedMonthsList)
var month = selectedRmYear.completedMonthsList.filter(m => m.month == monthId)[0];
return month ? month.completed : null;

else
return null;





enter image description here










share|improve this question






























    0















    I have been using a Syncfusion grid in my angular (v.6.0.8) project. In one of the pages, users can mark months as completed by checkboxes.



    It causes to some of the status changes in the model. Hence, I update the model using "splice", after the backend call is completed. In order to reflect the changes on the grid, I have to call this.deliveryItemsGrid.refresh(); but, this cause to lose the position where the user is working on (grid scrolls up to the top).



    Is there a way that I could use to refresh the grid without changing the scroll bar position?



    [HTML]



     <!-- JAN -->
    <e-column headerText="JAN" [customAttributes]="class: 'textAlignment'">
    <ng-template #template let-data>
    <div> <i class="fa fa-wrench fa-2x" [style.color]="getMonthColorRM(data, 0)"></i></div>
    <div *ngIf="!isReadOnlyUser" class="custom-control custom-checkbox">
    <input id="chkChangeStatusRMdata.rmDetailId + 'JAN'" type="checkbox" class="custom-control-input"
    [checked]="getMonthCompletionStatus(data, 0)" (change)="saveStatusRM(data,'0')" aria-label="Complete Task" />
    <label *ngIf="getMonthCompletionStatus(data, 0)" class="custom-control-label rm-month" for="chkChangeStatusRMdata.rmDetailId + 'JAN'" data-toggle="tooltip" data-placement="top" title="Mark as not complete"></label>
    <label *ngIf="!getMonthCompletionStatus(data, 0)" class="custom-control-label rm-month" for="chkChangeStatusRMdata.rmDetailId + 'JAN'" data-toggle="tooltip" data-placement="top" title="Mark as complete"></label>
    </div>
    <div *ngIf="data.type != 'RM' && ((data?.plannedDate?.getMonth()) == 0)"> <i id="'JAN'+ data.type + data.id" class="fa fa-wrench fa-2x" [style.color]="getMonthColorCM(data)"></i></div>
    </ng-template>
    </e-column>


    [ts file]



    private saveStatusRM(row: DeliveryPlanModel, monthId) 
    if (row && row.rmYears)
    let selectedRmYear: IYearModel = row.rmYears.filter(y => y.year == this.selectedYear.toString())[0];
    selectedRmYear.schoolNumber = this.schoolNumber;
    selectedRmYear.completedMonthsList.filter(m => m.month == monthId)[0].completed = !selectedRmYear.completedMonthsList.filter(m => m.month == monthId)[0].completed;
    selectedRmYear.completed = selectedRmYear.completedMonthsList.every(m => m.completed);

    if (selectedRmYear.completed)
    row.statusDisplay = "Completed";
    else
    if (selectedRmYear.completedMonthsList.some(m => m.completed))
    row.statusDisplay = "In progress";
    else
    row.statusDisplay = "Planned";


    // Set the color of the spanners (This is only for front-end use)
    selectedRmYear.completedMonthsList.forEach(x =>
    let color: string = "";
    if (x.completed)
    color = "green";

    else
    let dueOn: Date = new Date(+selectedRmYear.year, +x.month + 1, 1);
    let currentDate: Date = new Date();
    color = currentDate < dueOn ? "black" : "red";

    x.color = color;
    )
    // Update the record on the Database.
    this.deliveryPlanService.updateStatusRM(selectedRmYear).subscribe(
    data =>
    if (data)
    // Replace the updated record in 'gridRows'
    var selectedRow = this.gridRows.filter(x => x.rmDetailId == row.rmDetailId)[0]
    var selectedRecordIndex = this.gridRows.indexOf(selectedRow);
    this.gridRows.splice(selectedRecordIndex, 1, row);
    this.calculateRmProgress(this.gridRows);
    //this.deliveryItemsGrid.refresh();

    );




    private getMonthCompletionStatus(row: DeliveryPlanModel, monthId): boolean
    if (row && row.rmYears)
    let selectedRmYear: IYearModel = row.rmYears.filter(y => y.year == this.selectedYear.toString())[0];
    if (selectedRmYear && selectedRmYear.completedMonthsList)
    var month = selectedRmYear.completedMonthsList.filter(m => m.month == monthId)[0];
    return month ? month.completed : null;

    else
    return null;





    enter image description here










    share|improve this question


























      0












      0








      0








      I have been using a Syncfusion grid in my angular (v.6.0.8) project. In one of the pages, users can mark months as completed by checkboxes.



      It causes to some of the status changes in the model. Hence, I update the model using "splice", after the backend call is completed. In order to reflect the changes on the grid, I have to call this.deliveryItemsGrid.refresh(); but, this cause to lose the position where the user is working on (grid scrolls up to the top).



      Is there a way that I could use to refresh the grid without changing the scroll bar position?



      [HTML]



       <!-- JAN -->
      <e-column headerText="JAN" [customAttributes]="class: 'textAlignment'">
      <ng-template #template let-data>
      <div> <i class="fa fa-wrench fa-2x" [style.color]="getMonthColorRM(data, 0)"></i></div>
      <div *ngIf="!isReadOnlyUser" class="custom-control custom-checkbox">
      <input id="chkChangeStatusRMdata.rmDetailId + 'JAN'" type="checkbox" class="custom-control-input"
      [checked]="getMonthCompletionStatus(data, 0)" (change)="saveStatusRM(data,'0')" aria-label="Complete Task" />
      <label *ngIf="getMonthCompletionStatus(data, 0)" class="custom-control-label rm-month" for="chkChangeStatusRMdata.rmDetailId + 'JAN'" data-toggle="tooltip" data-placement="top" title="Mark as not complete"></label>
      <label *ngIf="!getMonthCompletionStatus(data, 0)" class="custom-control-label rm-month" for="chkChangeStatusRMdata.rmDetailId + 'JAN'" data-toggle="tooltip" data-placement="top" title="Mark as complete"></label>
      </div>
      <div *ngIf="data.type != 'RM' && ((data?.plannedDate?.getMonth()) == 0)"> <i id="'JAN'+ data.type + data.id" class="fa fa-wrench fa-2x" [style.color]="getMonthColorCM(data)"></i></div>
      </ng-template>
      </e-column>


      [ts file]



      private saveStatusRM(row: DeliveryPlanModel, monthId) 
      if (row && row.rmYears)
      let selectedRmYear: IYearModel = row.rmYears.filter(y => y.year == this.selectedYear.toString())[0];
      selectedRmYear.schoolNumber = this.schoolNumber;
      selectedRmYear.completedMonthsList.filter(m => m.month == monthId)[0].completed = !selectedRmYear.completedMonthsList.filter(m => m.month == monthId)[0].completed;
      selectedRmYear.completed = selectedRmYear.completedMonthsList.every(m => m.completed);

      if (selectedRmYear.completed)
      row.statusDisplay = "Completed";
      else
      if (selectedRmYear.completedMonthsList.some(m => m.completed))
      row.statusDisplay = "In progress";
      else
      row.statusDisplay = "Planned";


      // Set the color of the spanners (This is only for front-end use)
      selectedRmYear.completedMonthsList.forEach(x =>
      let color: string = "";
      if (x.completed)
      color = "green";

      else
      let dueOn: Date = new Date(+selectedRmYear.year, +x.month + 1, 1);
      let currentDate: Date = new Date();
      color = currentDate < dueOn ? "black" : "red";

      x.color = color;
      )
      // Update the record on the Database.
      this.deliveryPlanService.updateStatusRM(selectedRmYear).subscribe(
      data =>
      if (data)
      // Replace the updated record in 'gridRows'
      var selectedRow = this.gridRows.filter(x => x.rmDetailId == row.rmDetailId)[0]
      var selectedRecordIndex = this.gridRows.indexOf(selectedRow);
      this.gridRows.splice(selectedRecordIndex, 1, row);
      this.calculateRmProgress(this.gridRows);
      //this.deliveryItemsGrid.refresh();

      );




      private getMonthCompletionStatus(row: DeliveryPlanModel, monthId): boolean
      if (row && row.rmYears)
      let selectedRmYear: IYearModel = row.rmYears.filter(y => y.year == this.selectedYear.toString())[0];
      if (selectedRmYear && selectedRmYear.completedMonthsList)
      var month = selectedRmYear.completedMonthsList.filter(m => m.month == monthId)[0];
      return month ? month.completed : null;

      else
      return null;





      enter image description here










      share|improve this question
















      I have been using a Syncfusion grid in my angular (v.6.0.8) project. In one of the pages, users can mark months as completed by checkboxes.



      It causes to some of the status changes in the model. Hence, I update the model using "splice", after the backend call is completed. In order to reflect the changes on the grid, I have to call this.deliveryItemsGrid.refresh(); but, this cause to lose the position where the user is working on (grid scrolls up to the top).



      Is there a way that I could use to refresh the grid without changing the scroll bar position?



      [HTML]



       <!-- JAN -->
      <e-column headerText="JAN" [customAttributes]="class: 'textAlignment'">
      <ng-template #template let-data>
      <div> <i class="fa fa-wrench fa-2x" [style.color]="getMonthColorRM(data, 0)"></i></div>
      <div *ngIf="!isReadOnlyUser" class="custom-control custom-checkbox">
      <input id="chkChangeStatusRMdata.rmDetailId + 'JAN'" type="checkbox" class="custom-control-input"
      [checked]="getMonthCompletionStatus(data, 0)" (change)="saveStatusRM(data,'0')" aria-label="Complete Task" />
      <label *ngIf="getMonthCompletionStatus(data, 0)" class="custom-control-label rm-month" for="chkChangeStatusRMdata.rmDetailId + 'JAN'" data-toggle="tooltip" data-placement="top" title="Mark as not complete"></label>
      <label *ngIf="!getMonthCompletionStatus(data, 0)" class="custom-control-label rm-month" for="chkChangeStatusRMdata.rmDetailId + 'JAN'" data-toggle="tooltip" data-placement="top" title="Mark as complete"></label>
      </div>
      <div *ngIf="data.type != 'RM' && ((data?.plannedDate?.getMonth()) == 0)"> <i id="'JAN'+ data.type + data.id" class="fa fa-wrench fa-2x" [style.color]="getMonthColorCM(data)"></i></div>
      </ng-template>
      </e-column>


      [ts file]



      private saveStatusRM(row: DeliveryPlanModel, monthId) 
      if (row && row.rmYears)
      let selectedRmYear: IYearModel = row.rmYears.filter(y => y.year == this.selectedYear.toString())[0];
      selectedRmYear.schoolNumber = this.schoolNumber;
      selectedRmYear.completedMonthsList.filter(m => m.month == monthId)[0].completed = !selectedRmYear.completedMonthsList.filter(m => m.month == monthId)[0].completed;
      selectedRmYear.completed = selectedRmYear.completedMonthsList.every(m => m.completed);

      if (selectedRmYear.completed)
      row.statusDisplay = "Completed";
      else
      if (selectedRmYear.completedMonthsList.some(m => m.completed))
      row.statusDisplay = "In progress";
      else
      row.statusDisplay = "Planned";


      // Set the color of the spanners (This is only for front-end use)
      selectedRmYear.completedMonthsList.forEach(x =>
      let color: string = "";
      if (x.completed)
      color = "green";

      else
      let dueOn: Date = new Date(+selectedRmYear.year, +x.month + 1, 1);
      let currentDate: Date = new Date();
      color = currentDate < dueOn ? "black" : "red";

      x.color = color;
      )
      // Update the record on the Database.
      this.deliveryPlanService.updateStatusRM(selectedRmYear).subscribe(
      data =>
      if (data)
      // Replace the updated record in 'gridRows'
      var selectedRow = this.gridRows.filter(x => x.rmDetailId == row.rmDetailId)[0]
      var selectedRecordIndex = this.gridRows.indexOf(selectedRow);
      this.gridRows.splice(selectedRecordIndex, 1, row);
      this.calculateRmProgress(this.gridRows);
      //this.deliveryItemsGrid.refresh();

      );




      private getMonthCompletionStatus(row: DeliveryPlanModel, monthId): boolean
      if (row && row.rmYears)
      let selectedRmYear: IYearModel = row.rmYears.filter(y => y.year == this.selectedYear.toString())[0];
      if (selectedRmYear && selectedRmYear.completedMonthsList)
      var month = selectedRmYear.completedMonthsList.filter(m => m.month == monthId)[0];
      return month ? month.completed : null;

      else
      return null;





      enter image description here







      angular typescript syncfusion






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 26 at 1:40







      Kushan Randima

















      asked Mar 24 at 23:52









      Kushan RandimaKushan Randima

      7032 gold badges15 silver badges40 bronze badges




      7032 gold badges15 silver badges40 bronze badges






















          2 Answers
          2






          active

          oldest

          votes


















          1














          We have analyzed your query and we suggest to get the scrollTop value before the refresh method invoke and bind it to the grid scroll bar after the refresh operation completed using actionComplete event. Please refer to the below sample and documentation for your reference,



          complete(args)
          if(args.requestType == 'refresh' && this.scrollVal)
          this.grid.getContent().firstElementChild.scrollTop = this.scrollVal;
          this.scrollVal = 0;


          refresh()
          this.scrollVal = this.grid.getContent().firstElementChild.scrollTop;
          this.grid.refresh();



          Sample: https://stackblitz.com/edit/angular-gg4hgd-hrxcwr?file=default.component.ts



          Documentation: https://ej2.syncfusion.com/documentation/api/grid/#actioncomplete



          Please get back to us for further assistance.



          Regards,
          Thavasianand S.






          share|improve this answer























          • I appreciate for your prompt reply and support. I went with my own solution in the end because it's a more succinct way of achieving the same thing. Just for info I'm using this update function in two separate five kinds of rows in the grid. I checked your solution too and it works perfectly fine for me. Thanks!

            – Kushan Randima
            Mar 26 at 23:00


















          0














          I was able to find a solution to the issue. I used "rowDataBound" and "dataBound" events to achieve that. Please refer to the code below.



          [HTML]



          <ejs-grid #deliveryItemsGrid id="deliveryItemsGrid"
          [dataSource]="gridRows"
          [gridLines]="componentVariables.gridLines"
          [allowPaging]="componentVariables.allowPaging"
          [allowGrouping]="componentVariables.allowGrouping"
          [allowSorting]="componentVariables.allowSorting"
          [allowSelection]="componentVariables.allowSelection"
          [allowTextWrap]="componentVariables.allowTextWrap"
          [allowFiltering]="componentVariables.allowFiltering"
          [pageSettings]="componentVariables.pageSettings"
          [filterSettings]="componentVariables.filterOptions"
          [selectedRowIndex]="selectedRowIndex"
          [selectionSettings]="selectionOptions"
          [toolbar]="componentVariables.toolbarOptions"
          (toolbarClick)="toolbarClick($event)"
          (rowDataBound)="rowDataBound($event)"
          (dataBound)="dataBound($event)">


          [ts]



          I created two global variables, to store the selected indexes.



           selectedIndexes: number[] = [];
          justNowUpdatedId = 0;


          Then, in all the update functions, before calling the refresh() method, I keep the relevant id in the 'justNowUpdatedId' variable.



          Finally, I implement "rowDataBound" and "dataBound" events in order to preserve the position which the user was working before.



          public rowDataBound(args): void args.data['type'] == 'DPC') && args.data['id'] == this.justNowUpdatedId) 
          this.selectedIndexes.push(parseInt(args.row.getAttribute('aria-rowindex')));



          public dataBound(args): void
          if (this.selectedIndexes.length)
          this.deliveryItemsGrid.selectRows(this.selectedIndexes);
          this.selectedIndexes = [];







          share|improve this answer

























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55329689%2fhow-to-focus-the-updated-record-after-refreshing-a-syncfusion-grid%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            We have analyzed your query and we suggest to get the scrollTop value before the refresh method invoke and bind it to the grid scroll bar after the refresh operation completed using actionComplete event. Please refer to the below sample and documentation for your reference,



            complete(args)
            if(args.requestType == 'refresh' && this.scrollVal)
            this.grid.getContent().firstElementChild.scrollTop = this.scrollVal;
            this.scrollVal = 0;


            refresh()
            this.scrollVal = this.grid.getContent().firstElementChild.scrollTop;
            this.grid.refresh();



            Sample: https://stackblitz.com/edit/angular-gg4hgd-hrxcwr?file=default.component.ts



            Documentation: https://ej2.syncfusion.com/documentation/api/grid/#actioncomplete



            Please get back to us for further assistance.



            Regards,
            Thavasianand S.






            share|improve this answer























            • I appreciate for your prompt reply and support. I went with my own solution in the end because it's a more succinct way of achieving the same thing. Just for info I'm using this update function in two separate five kinds of rows in the grid. I checked your solution too and it works perfectly fine for me. Thanks!

              – Kushan Randima
              Mar 26 at 23:00















            1














            We have analyzed your query and we suggest to get the scrollTop value before the refresh method invoke and bind it to the grid scroll bar after the refresh operation completed using actionComplete event. Please refer to the below sample and documentation for your reference,



            complete(args)
            if(args.requestType == 'refresh' && this.scrollVal)
            this.grid.getContent().firstElementChild.scrollTop = this.scrollVal;
            this.scrollVal = 0;


            refresh()
            this.scrollVal = this.grid.getContent().firstElementChild.scrollTop;
            this.grid.refresh();



            Sample: https://stackblitz.com/edit/angular-gg4hgd-hrxcwr?file=default.component.ts



            Documentation: https://ej2.syncfusion.com/documentation/api/grid/#actioncomplete



            Please get back to us for further assistance.



            Regards,
            Thavasianand S.






            share|improve this answer























            • I appreciate for your prompt reply and support. I went with my own solution in the end because it's a more succinct way of achieving the same thing. Just for info I'm using this update function in two separate five kinds of rows in the grid. I checked your solution too and it works perfectly fine for me. Thanks!

              – Kushan Randima
              Mar 26 at 23:00













            1












            1








            1







            We have analyzed your query and we suggest to get the scrollTop value before the refresh method invoke and bind it to the grid scroll bar after the refresh operation completed using actionComplete event. Please refer to the below sample and documentation for your reference,



            complete(args)
            if(args.requestType == 'refresh' && this.scrollVal)
            this.grid.getContent().firstElementChild.scrollTop = this.scrollVal;
            this.scrollVal = 0;


            refresh()
            this.scrollVal = this.grid.getContent().firstElementChild.scrollTop;
            this.grid.refresh();



            Sample: https://stackblitz.com/edit/angular-gg4hgd-hrxcwr?file=default.component.ts



            Documentation: https://ej2.syncfusion.com/documentation/api/grid/#actioncomplete



            Please get back to us for further assistance.



            Regards,
            Thavasianand S.






            share|improve this answer













            We have analyzed your query and we suggest to get the scrollTop value before the refresh method invoke and bind it to the grid scroll bar after the refresh operation completed using actionComplete event. Please refer to the below sample and documentation for your reference,



            complete(args)
            if(args.requestType == 'refresh' && this.scrollVal)
            this.grid.getContent().firstElementChild.scrollTop = this.scrollVal;
            this.scrollVal = 0;


            refresh()
            this.scrollVal = this.grid.getContent().firstElementChild.scrollTop;
            this.grid.refresh();



            Sample: https://stackblitz.com/edit/angular-gg4hgd-hrxcwr?file=default.component.ts



            Documentation: https://ej2.syncfusion.com/documentation/api/grid/#actioncomplete



            Please get back to us for further assistance.



            Regards,
            Thavasianand S.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 26 at 5:25









            S.T AnandS.T Anand

            111 bronze badge




            111 bronze badge












            • I appreciate for your prompt reply and support. I went with my own solution in the end because it's a more succinct way of achieving the same thing. Just for info I'm using this update function in two separate five kinds of rows in the grid. I checked your solution too and it works perfectly fine for me. Thanks!

              – Kushan Randima
              Mar 26 at 23:00

















            • I appreciate for your prompt reply and support. I went with my own solution in the end because it's a more succinct way of achieving the same thing. Just for info I'm using this update function in two separate five kinds of rows in the grid. I checked your solution too and it works perfectly fine for me. Thanks!

              – Kushan Randima
              Mar 26 at 23:00
















            I appreciate for your prompt reply and support. I went with my own solution in the end because it's a more succinct way of achieving the same thing. Just for info I'm using this update function in two separate five kinds of rows in the grid. I checked your solution too and it works perfectly fine for me. Thanks!

            – Kushan Randima
            Mar 26 at 23:00





            I appreciate for your prompt reply and support. I went with my own solution in the end because it's a more succinct way of achieving the same thing. Just for info I'm using this update function in two separate five kinds of rows in the grid. I checked your solution too and it works perfectly fine for me. Thanks!

            – Kushan Randima
            Mar 26 at 23:00













            0














            I was able to find a solution to the issue. I used "rowDataBound" and "dataBound" events to achieve that. Please refer to the code below.



            [HTML]



            <ejs-grid #deliveryItemsGrid id="deliveryItemsGrid"
            [dataSource]="gridRows"
            [gridLines]="componentVariables.gridLines"
            [allowPaging]="componentVariables.allowPaging"
            [allowGrouping]="componentVariables.allowGrouping"
            [allowSorting]="componentVariables.allowSorting"
            [allowSelection]="componentVariables.allowSelection"
            [allowTextWrap]="componentVariables.allowTextWrap"
            [allowFiltering]="componentVariables.allowFiltering"
            [pageSettings]="componentVariables.pageSettings"
            [filterSettings]="componentVariables.filterOptions"
            [selectedRowIndex]="selectedRowIndex"
            [selectionSettings]="selectionOptions"
            [toolbar]="componentVariables.toolbarOptions"
            (toolbarClick)="toolbarClick($event)"
            (rowDataBound)="rowDataBound($event)"
            (dataBound)="dataBound($event)">


            [ts]



            I created two global variables, to store the selected indexes.



             selectedIndexes: number[] = [];
            justNowUpdatedId = 0;


            Then, in all the update functions, before calling the refresh() method, I keep the relevant id in the 'justNowUpdatedId' variable.



            Finally, I implement "rowDataBound" and "dataBound" events in order to preserve the position which the user was working before.



            public rowDataBound(args): void args.data['type'] == 'DPC') && args.data['id'] == this.justNowUpdatedId) 
            this.selectedIndexes.push(parseInt(args.row.getAttribute('aria-rowindex')));



            public dataBound(args): void
            if (this.selectedIndexes.length)
            this.deliveryItemsGrid.selectRows(this.selectedIndexes);
            this.selectedIndexes = [];







            share|improve this answer



























              0














              I was able to find a solution to the issue. I used "rowDataBound" and "dataBound" events to achieve that. Please refer to the code below.



              [HTML]



              <ejs-grid #deliveryItemsGrid id="deliveryItemsGrid"
              [dataSource]="gridRows"
              [gridLines]="componentVariables.gridLines"
              [allowPaging]="componentVariables.allowPaging"
              [allowGrouping]="componentVariables.allowGrouping"
              [allowSorting]="componentVariables.allowSorting"
              [allowSelection]="componentVariables.allowSelection"
              [allowTextWrap]="componentVariables.allowTextWrap"
              [allowFiltering]="componentVariables.allowFiltering"
              [pageSettings]="componentVariables.pageSettings"
              [filterSettings]="componentVariables.filterOptions"
              [selectedRowIndex]="selectedRowIndex"
              [selectionSettings]="selectionOptions"
              [toolbar]="componentVariables.toolbarOptions"
              (toolbarClick)="toolbarClick($event)"
              (rowDataBound)="rowDataBound($event)"
              (dataBound)="dataBound($event)">


              [ts]



              I created two global variables, to store the selected indexes.



               selectedIndexes: number[] = [];
              justNowUpdatedId = 0;


              Then, in all the update functions, before calling the refresh() method, I keep the relevant id in the 'justNowUpdatedId' variable.



              Finally, I implement "rowDataBound" and "dataBound" events in order to preserve the position which the user was working before.



              public rowDataBound(args): void args.data['type'] == 'DPC') && args.data['id'] == this.justNowUpdatedId) 
              this.selectedIndexes.push(parseInt(args.row.getAttribute('aria-rowindex')));



              public dataBound(args): void
              if (this.selectedIndexes.length)
              this.deliveryItemsGrid.selectRows(this.selectedIndexes);
              this.selectedIndexes = [];







              share|improve this answer

























                0












                0








                0







                I was able to find a solution to the issue. I used "rowDataBound" and "dataBound" events to achieve that. Please refer to the code below.



                [HTML]



                <ejs-grid #deliveryItemsGrid id="deliveryItemsGrid"
                [dataSource]="gridRows"
                [gridLines]="componentVariables.gridLines"
                [allowPaging]="componentVariables.allowPaging"
                [allowGrouping]="componentVariables.allowGrouping"
                [allowSorting]="componentVariables.allowSorting"
                [allowSelection]="componentVariables.allowSelection"
                [allowTextWrap]="componentVariables.allowTextWrap"
                [allowFiltering]="componentVariables.allowFiltering"
                [pageSettings]="componentVariables.pageSettings"
                [filterSettings]="componentVariables.filterOptions"
                [selectedRowIndex]="selectedRowIndex"
                [selectionSettings]="selectionOptions"
                [toolbar]="componentVariables.toolbarOptions"
                (toolbarClick)="toolbarClick($event)"
                (rowDataBound)="rowDataBound($event)"
                (dataBound)="dataBound($event)">


                [ts]



                I created two global variables, to store the selected indexes.



                 selectedIndexes: number[] = [];
                justNowUpdatedId = 0;


                Then, in all the update functions, before calling the refresh() method, I keep the relevant id in the 'justNowUpdatedId' variable.



                Finally, I implement "rowDataBound" and "dataBound" events in order to preserve the position which the user was working before.



                public rowDataBound(args): void args.data['type'] == 'DPC') && args.data['id'] == this.justNowUpdatedId) 
                this.selectedIndexes.push(parseInt(args.row.getAttribute('aria-rowindex')));



                public dataBound(args): void
                if (this.selectedIndexes.length)
                this.deliveryItemsGrid.selectRows(this.selectedIndexes);
                this.selectedIndexes = [];







                share|improve this answer













                I was able to find a solution to the issue. I used "rowDataBound" and "dataBound" events to achieve that. Please refer to the code below.



                [HTML]



                <ejs-grid #deliveryItemsGrid id="deliveryItemsGrid"
                [dataSource]="gridRows"
                [gridLines]="componentVariables.gridLines"
                [allowPaging]="componentVariables.allowPaging"
                [allowGrouping]="componentVariables.allowGrouping"
                [allowSorting]="componentVariables.allowSorting"
                [allowSelection]="componentVariables.allowSelection"
                [allowTextWrap]="componentVariables.allowTextWrap"
                [allowFiltering]="componentVariables.allowFiltering"
                [pageSettings]="componentVariables.pageSettings"
                [filterSettings]="componentVariables.filterOptions"
                [selectedRowIndex]="selectedRowIndex"
                [selectionSettings]="selectionOptions"
                [toolbar]="componentVariables.toolbarOptions"
                (toolbarClick)="toolbarClick($event)"
                (rowDataBound)="rowDataBound($event)"
                (dataBound)="dataBound($event)">


                [ts]



                I created two global variables, to store the selected indexes.



                 selectedIndexes: number[] = [];
                justNowUpdatedId = 0;


                Then, in all the update functions, before calling the refresh() method, I keep the relevant id in the 'justNowUpdatedId' variable.



                Finally, I implement "rowDataBound" and "dataBound" events in order to preserve the position which the user was working before.



                public rowDataBound(args): void args.data['type'] == 'DPC') && args.data['id'] == this.justNowUpdatedId) 
                this.selectedIndexes.push(parseInt(args.row.getAttribute('aria-rowindex')));



                public dataBound(args): void
                if (this.selectedIndexes.length)
                this.deliveryItemsGrid.selectRows(this.selectedIndexes);
                this.selectedIndexes = [];








                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 26 at 22:59









                Kushan RandimaKushan Randima

                7032 gold badges15 silver badges40 bronze badges




                7032 gold badges15 silver badges40 bronze badges



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55329689%2fhow-to-focus-the-updated-record-after-refreshing-a-syncfusion-grid%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript