Not updted rows while page change

Hi Team,


Hi Team,

I required to update and delete  multiple records of text box and dropdown list by using ejs-grid


I followed this steps 

      

        1. Change text vale and dropdown and  select two rows and go to second page

        2. Showing to second page

         3. And come back to first page

once come back to first page updated values are not showing . it is showing previous values.

i need updated values once come back to first page.
i am sending code what i used code , please find attached file and let me know asap.

Thanks & Regards
Chalamaiah N







Attachment: not_updted_rows_while_page_change_bacdd138.zip

7 Replies

NC Narsimsetty Chalamaiah May 30, 2022 12:11 PM UTC

Hi Team,


I am adding 2nd  issue for update 

1st page I selected 2 records and second page I  selected 2 records and click save button 


1stpage:



2nd page 



please check debugger data



please check this scenario also 

i used below code what synfusion team provided , it is showing current page records only not total records for update total records .

 

let selectedRecords = this.grid.getSelectedRecords();

    let selRows = this.grid.getSelectedRows();

    let selIndex = this.grid.getSelectedRowIndexes();

    selectedRecords.map((e, i) => {

      e['LvlName1'] = (

        selRows[i].querySelector('.e-textbox input') as any).value;

      e['Active'] = (selRows[i].querySelector('.e-ddl input') as any).value;

     // this.grid.updateRow(selIndex[i], e);

    });

    debugger;

    var s1 = selectedRecords;




Thanks & Regards

Chalamaiah N



NC Narsimsetty Chalamaiah replied to Narsimsetty Chalamaiah May 31, 2022 07:27 AM UTC

please reply asap..



NC Narsimsetty Chalamaiah May 31, 2022 10:36 AM UTC

it is a production issue ,please replay asap.



NC Narsimsetty Chalamaiah May 31, 2022 11:07 AM UTC

Please setup call on tomorrow by 01:30pm to 5:30pm IST,


it is a production issue please respond asap. 



RR Rajapandi Ravi Syncfusion Team May 31, 2022 12:50 PM UTC

Hi Narsimsetty,


Greetings from Syncfusion support


In your query you have mentioned that “once come back to first page updated values are not showing . it is showing previous values”, we found that you are changing the value only from the textbox and dropdown template columns. After changing the value of the template components, you visit to next page and coming back to first page it will not update the changes to the datasource. So only it will show the previous value from the datasource.


After performing changes in the template column, in change event of the template components you need to call the updateCell() method with respective arguments to update the specified cell with the new changes, if we visit the next page without saving the current page changes, the current page changes will be lost the new updated data. It was the default behavior of batch edit mode. So, we suggest you save the changes of your current page before you visit to the next page. Please refer the below code example and sample for more information.


 

<ejs-grid #grid height="450" [selectionSettings]="selectOptions" [dataSource]='data' allowPaging='true' [pageSettings]='pageSettings' [editSettings]='editSettings' [toolbar]='toolbar'>

            <e-columns>

            <e-column type='checkbox' width='50'></e-column>

            <e-column field='LvlName1' headerText='Lvl Name1' width=150 [customAttributes]='customAttributes' [visible]='!btnhideEditSave'></e-column>

            <e-column field='LvlName1' headerText="Lvl Name1" width="150" [customAttributes]='customAttributes' [visible]='btnhideEditSave'>

              <ng-template let-data #template>

                <ejs-textbox (change)="change($event)" value="{{data.LvlName1}}" ></ejs-textbox>

              </ng-template>

            </e-column>

            <e-column field='Active' headerText='Active' width=200 [customAttributes]='customAttributes' [visible]='!btnhideEditSave'></e-column>

            <e-column field='Active' headerText="Active" width="200" [customAttributes]='customAttributes' [visible]='btnhideEditSave'>

              <ng-template let-data #template>

                <ejs-dropdownlist id="Active" name="Active" (change)="dropchange($event)" [dataSource]="customerIDDistinctData"

                                  [fields]="{ text: 'Value', value: 'Key' }" value="{{data.Active}}"                                      

                                  popupHeight="300px">

                </ejs-dropdownlist>

              </ng-template>

            </e-column>

    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .

    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .

            </e-columns>

        </ejs-grid>

 


 

change(args) { //change event of textbox component

        var rowDetails = this.grid.getRowInfo(args.event.target.closest('tr'));

        this.grid.updateCell(rowDetails.rowIndex, 'LvlName1', args.value);

      }

      dropchange(args) {//change event of dropdown component

        var rowDetails = this.grid.getRowInfo(args.element.closest('tr'));

        this.grid.updateCell(rowDetails.rowIndex, 'Active', args.value);

      }

 


Sample: https://stackblitz.com/edit/angular-efvuvw?file=app.component.ts


API: https://ej2.syncfusion.com/angular/documentation/api/grid#updatecell


Regards,

Rajapandi R



NC Narsimsetty Chalamaiah June 3, 2022 03:30 PM UTC

HI 


we have discussed with client , they need multiple update records at a time , not required to use 2 times  update in grid.

 is it possible to update once to db? 


Please setup call on 06-june-2022 by 03:00pm to 5:30pm IST,


it is a production issue please respond asap. 

Thanks & Regards

Chalamaiah N



RR Rajapandi Ravi Syncfusion Team June 6, 2022 04:08 PM UTC

Hi Narsimsetty,


Thanks for the update.


Before scheduling meeting, you must send your problem scenario via video demonstration and Grid code example, then only we validate your requirement with our source. It’s more helpful to us. After that we can schedule a meeting.


Please share the below details that will be helpful for us to provide better solution.


1)         Please share your exact requirement scenario step by step with detailed description.


2)         Please share the issue scenario in video demonstration format.


3)         Please share your complete Grid rendering code.


4)         Please share your syncfusion package version.


Regards,

Rajapandi R


Loader.
Up arrow icon