Author Topic: Rendering Cells  (Read 5405 times)

rgorantla

  • Pro Deluxe
  • Jr. Member
  • *
  • Posts: 88
    • View Profile
Rendering Cells
« 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 ?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Rendering Cells
« Reply #1 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
« Last Edit: October 13, 2014, 11:05:14 pm by paramquery »

rgorantla

  • Pro Deluxe
  • Jr. Member
  • *
  • Posts: 88
    • View Profile
Re: Rendering Cells
« Reply #2 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);
        }


    };

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Rendering Cells
« Reply #3 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.
« Last Edit: October 13, 2014, 11:45:57 pm by paramquery »

rgorantla

  • Pro Deluxe
  • Jr. Member
  • *
  • Posts: 88
    • View Profile
Re: Rendering Cells
« Reply #4 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/

« Last Edit: October 14, 2014, 01:21:04 am by roseline.gorantla »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Rendering Cells
« Reply #5 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, ..... } );
                        }
                     }
                 }
« Last Edit: October 15, 2014, 05:49:37 pm by paramquery »

rgorantla

  • Pro Deluxe
  • Jr. Member
  • *
  • Posts: 88
    • View Profile
Re: Rendering Cells
« Reply #6 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);
        }

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Rendering Cells
« Reply #7 on: October 15, 2014, 05:50:15 pm »
Please check the updated code for dataIndx in previous post.

rgorantla

  • Pro Deluxe
  • Jr. Member
  • *
  • Posts: 88
    • View Profile
Re: Rendering Cells
« Reply #8 on: October 15, 2014, 06:44:06 pm »
never mind -Took another apporach ... Thanks