Hi refresh grid inside in change

1 Answer 255 Views
Grid
bahaso
Top achievements
Rank 1
Iron
Iron
Iron
bahaso asked on 09 Jul 2021, 06:48 AM

Hi

Currently i have an change on an drop in a Grid and then i change some any data too, but i could not refresh grid after all my jquery changes

Regards

In first step i change an codeErreur with an dropdown then i change on others lines in grid same field, but i could not refresh my grid

 

    var getDatasourceFromUrlDetailEtatCompte = function (relativeUrl, schema) {
        return new kendo.data.DataSource({
            transport: {
                dataType: "json",
                read: {
                    url: UtilService.generateApiUrl(relativeUrl)
                }
            },
            change: function (e) {
                if (e.action === "itemchange") {
                    var errload = {
                        type: e.items[0].type,
                        source: e.items[0].source,
                        compte: e.items[0].compte,
                        date: e.items[0].date,
                        facture: e.items[0].facture,
                        total: e.items[0].total,
                        codeErreur: e.items[0].codeErreur
                    };
                    RapportsService.saveErreurEtatCompte(errload).then(function success(response) {
                        console.log('ChangementB:' + response);
                        e.items[0].dirty = false;

                        const ref_facture = e.items[0].facture;
                        const ref_source = e.items[0].source;
                        const ref_codeErreur = e.items[0].codeErreur;


                        var tgrid = e.sender._data;
                        for (var i = 0; i < tgrid.length; i++) {
                            if (tgrid[i].facture == ref_facture && tgrid[i].source != ref_source) {
                                tgrid[i].codeErreur = ref_codeErreur; // change same error code
                                var errload2 = {
                                    type: tgrid[i].type,
                                    source: tgrid[i].source,
                                    compte: tgrid[i].compte,
                                    date: tgrid[i].date,
                                    facture: tgrid[i].facture,
                                    total: tgrid[i].total,
                                    codeErreur: tgrid[i].codeErreur
                                };
                                RapportsService.saveErreurEtatCompte(errload2).then(function success(response2) {
                                }, function error(response2) {
                                    console.log('Error change:' + response2);
                                });

                            }
                        }

                        NotificationService.removeAll();
                        NotificationService.showSuccessP("global.save.success");

                    }, function error(response) {
                        console.log('Changementc:' + response);
                        if (!UtilService.responseValidationParsing(response)) {
                            NotificationService.showErrorP("global.save.error");
                        }
                    });
                }
            },
            schema: schema
        });
    };

1 Answer, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 13 Jul 2021, 02:26 PM

Hi,

From the provided information I am not sure about the scenario and the desired result. I will appreciate it if you could send us more details about the requirements.

Note, that you could refresh the Grid using the refresh method

- https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/methods/refresh

In case you need to set some value in the change event handler of the dataSource, you could use the model.set() method as in the Dojo example linked here.

Regards,
Neli
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Grid
Asked by
bahaso
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Neli
Telerik team
Share this question
or