Author Topic: isDirty() returns false when data keyed in, true if pasted in  (Read 2130 times)

roofus

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 1
    • View Profile
isDirty() returns false when data keyed in, true if pasted in
« on: August 27, 2016, 02:58:38 am »
Hi,

We're got a strange situation with one instance of our grid. I key in a number in the column Breakout Value, then tab to move off the column. For example, 1000 was pulled from the database and I type in 5000 in that cell. When I hit the tab key, the red triangle shows up on the changed cell. However, isDirty() returns false. getChanges also returns a blank object.

If I copy the value 5000 from any other cell and paste into the row that was originally 1000, the red triangle faithfully shows up on the changed cell. This time, isDirty() returns true. And getChanges correctly contains the changed values

How can the red triangle appear to show changes but isDirty() says false? Why would it work differently (and correctly) if I paste in the value instead of keying it?

Definition within the column model:

        {
            title: "Breakout Value",
            width: 180,
            editable: true,
            hidden: false,
            dataType: "float",
            dataIndx: "BREAKOUT_VALUE",
            editModel: { keyUpDown: true },
            render: function (ui) {
                var cellData = ui.cellData;
                if (cellData) {
                    var num = Number(parseFloat(cellData).toFixed(0));
                    return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                }
            }
        },

Within the data model:

    var dataModelPercent = {
        location: "local",
        dataType: "JSON",
        method: "GET",
        getUrl: function () {
            return { url: Url4Percentcontroller };
        },
        getData: function (response) {
            return { data: response };
        },
        recIndx: "PERCENT_TYPE_VAL",
    };

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6263
    • View Profile
Re: isDirty() returns false when data keyed in, true if pasted in
« Reply #1 on: August 27, 2016, 09:50:58 am »
Haven't heard/experience the issue.

can you please help reproduce the issue: http://jsfiddle.net/z4tgp9no/

As a side note, you have implemented getData, getUrl callbacks of dataModel, but dataModel.location is 'local' ?