ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: rgorantla on October 13, 2014, 09:27:30 pm

Title: Rendering Cells
Post by: rgorantla on October 13, 2014, 09:27:30 pm
Rendering Cells not working when i am pasting cells.

    obj.cellSave = function (evt, ui) {

        $(this).pqGrid('refreshRow', { rowIndx: ui.rowIndx });
        var ratesarray = ["rateeeonly", "rateeeplusoneonly", "rateeeplus2", "rateeepluschildren", "rateeeplusspouse", "rateeefamily"];
        var contributionsarray = ["contreeonly", "contreeplusoneonly", "contreeplus2", "contreepluschildre", "contreeplusspouse", "contreefamily"]
        if (!($.inArray(ui.dataIndx, ratesarray) == -1)) {
            ratevalidations(ui);
            $(this).pqGrid("refreshCell", { rowIndx: ui.rowIndx, dataIndx: ui.dataIndx });
        }
        if (!($.inArray(ui.dataIndx, contributionsarray) == -1)) {
            contributionvalidations(ui);
            $(this).pqGrid("refreshCell", { rowIndx: ui.rowIndx, dataIndx: ui.dataIndx });
        }

    };

  contributionvalidations(ui) and rateContribution assign colors based on values entered..

Since save key is tab - when you tab on that cell it works - but when you try to paste colors are not displayed .

I need this to be Fixed ASAP . can you please help ?
Title: Re: Rendering Cells
Post by: paramvir on October 13, 2014, 11:03:38 pm
cellSave event is executed only after inline editing a cell, it doesn't execute after paste of data, undo, redo, etc.

Please choose change event to make any changes after change in data in grid as shown in this example: http://paramquery.com/pro/demos/editing_instant

Reference:
http://paramquery.com/pro/api#event-cellSave

http://paramquery.com/pro/api#event-change
Title: Re: Rendering Cells
Post by: rgorantla on October 13, 2014, 11:40:30 pm
Still the same :
I tried all possible events


    obj.change = function (evt, ui) {
        var ratesarray = ["rateeeonly", "rateeeplusoneonly", "rateeeplus2", "rateeepluschildren", "rateeeplusspouse", "rateeefamily"];
        var contributionsarray = ["contreeonly", "contreeplusoneonly", "contreeplus2", "contreepluschildre", "contreeplusspouse", "contreefamily"]
        if (!($.inArray(ui.dataIndx, ratesarray) == -1)) {
            ratevalidations(ui);
        }
        if (!($.inArray(ui.dataIndx, contributionsarray) == -1)) {
            contributionvalidations(ui);
        }


    };
Title: Re: Rendering Cells
Post by: paramvir on October 13, 2014, 11:43:00 pm
Please share your implementation via a jsfiddle.

There is no ui.dataIndx in change callback, please check the API and modify your code accordingly.
Title: Re: Rendering Cells
Post by: rgorantla on October 14, 2014, 12:55:15 am
but i need dataindx - and if the dataindex is one of those - call the functions.

http://jsfiddle.net/rgorantla/Ljd57c1k/1/

Title: Re: Rendering Cells
Post by: paramvir on October 14, 2014, 01:35:13 am
dataIndx ( one or more than one ) are available in change event as keys of ui.rowList[].newRow object.

Code: [Select]
                var rowList = ui.rowList;
               
                for (var i = 0; i < rowList.length; i++) {
                    var obj = rowList[i],
                        rowIndx = obj.rowIndx,
                        newRow = obj.newRow,
                        type = obj.type,
                        rowData = obj.rowData;

                     for(var dataIndx in newRow){
                        if (!($.inArray( dataIndx, ratesarray) == -1)) {
                           ratevalidations( { dataIndx: dataIndx, rowIndx: rowIndx, ..... } );
                        }
                     }
                 }
Title: Re: Rendering Cells
Post by: rgorantla on October 14, 2014, 09:34:44 pm
I am trying to get the propery of newRow not the value ... May be i am missing something...

As you have seen in jsfiddle , i need the exact cell name inorder to call wither of the functions not the value of the call , like below ... Can you help me how to get this implemented in change event?

if (!($.inArray(ui.dataIndx, ratesarray) == -1)) {
            ratevalidations(ui);
        }
        if (!($.inArray(ui.dataIndx, contributionsarray) == -1)) {
            contributionvalidations(ui);
        }
Title: Re: Rendering Cells
Post by: paramvir on October 15, 2014, 05:50:15 pm
Please check the updated code for dataIndx in previous post.
Title: Re: Rendering Cells
Post by: rgorantla on October 15, 2014, 06:44:06 pm
never mind -Took another apporach ... Thanks