Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Filtering a column data in a grid using checkbox

    Hello Isomorphic

    I have a code which builds a grid. I want the 'status' column to get changed while I select the checkbox in the 'Select' column. But, while clicking the select checkbox, I get the following error. I will really appreciate if you can help identify the problem.

    Error:
    09:12:20.999:pointerup8:WARN:Log:TypeError: Unable to get property 'grid' of undefined or null reference
    Stack from error.stack:
    changed () @ project:97:1060
    Class.fireCallback ()
    Class.fireCallback ()
    ListGrid.rowClick ()
    Function code () @ Function code:2:89
    GridRenderer._rowClick ()
    Class.invokeSuper ()
    Class.Super ()
    GridBody._rowClick ()
    GridRenderer.click ()

    Code:

    documentGrid: isc.ListGrid.create({
    canEdit: true,
    editEvent: "click",
    editByCell: true,
    modalEditing: true,
    selectionType: "single",
    alternateRecordStyles: true,
    canGroupBy: false,
    fields: [
    {name: "description", type: "text", required: true,
    validators: [
    {type: "lengthRange", min: 1, max: 30}
    ]
    },
    {name: "selected", type: "boolean", width: 80,
    changed: function(form, item, value) {
    var record = item.grid.getRecord(item.rowNum);
    if (value) {
    if (record.origStatus && record.origStatus != lead.RegulatoryItemWindow.Status.CANCELED) {
    record.status = record.origStatus;
    record.ready = record.origReady;
    record.sent= record.origSent;
    }
    else
    record.status = lead.RegulatoryItemWindow.Status.REQUESTED;
    }
    else {
    record.ready = null;
    record.sent = null;
    if (record.origStatus)
    record.status = lead.RegulatoryItemWindow.Status.CANCELED;
    else
    record.status = record.origStatus;
    }
    item.grid.markForRedraw();
    }

    },
    {name: "status", type: "text", width: 100,
    editorType: "select",
    editorProperties: {
    defaultValue: "Y",
    allowEmptyValue: false,
    addUnknownValues: false
    },
    changed: function(form, item, value) {
    var record = item.grid.getRecord(item.rowNum);
    if (value == lead.RegulatoryItemWindow.Status.READY) {
    record.ready = new Date();
    record.sent = null;
    }
    else if (value == lead.RegulatoryItemWindow.Status.CLOSED) {
    if (record.ready == null)
    record.ready = new Date();
    record.sent = new Date();
    }
    else {
    record.ready = null;
    record.sent = null;
    if (value == lead.RegulatoryItemWindow.Status.CANCELED)
    record.selected = false;
    }
    }
    },
    {name: "assigned", type: "text", width: 120},
    {name: "ready", type: "date", width: 90,
    validators: [
    {type: "dateRange", max: new Date()}
    ]
    },
    {name: "sent", type: "date", width: 90,
    validators: [
    {type: "dateRange", max: new Date()}
    ]
    }
    ],
    canEditCell: function(row, col) {
    var record = this.getRecord(row);
    switch (col) {
    case 0: // document
    return record.code == lead.RegulatoryItemWindow.MISC && (record.origStatus != lead.RegulatoryItemWindow.Status.READY && record.origStatus != lead.RegulatoryItemWindow.Status.CLOSED);
    case 1: // selected
    if (lead.RegulatoryItemWindow.allowClose)
    return record.origStatus != lead.RegulatoryItemWindow.Status.CLOSED;
    else
    return record.origStatus != lead.RegulatoryItemWindow.Status.READY && record.origStatus != lead.RegulatoryItemWindow.Status.CLOSED;
    case 2: // status
    if (lead.RegulatoryItemWindow.allowClose)
    return record.selected && record.origStatus != lead.RegulatoryItemWindow.Status.CLOSED;
    else
    return record.selected && (record.origStatus != lead.RegulatoryItemWindow.Status.READY && record.origStatus != lead.RegulatoryItemWindow.Status.CLOSED);
    case 3: // assigned
    return false;
    case 4: // ready date
    return lead.RegulatoryItemWindow.allowClose && (record.status == lead.RegulatoryItemWindow.Status.READY || (record.origStatus != lead.RegulatoryItemWindow.Status.CLOSED && record.status == lead.RegulatoryItemWindow.Status.CLOSED));
    case 5: // sent date
    return (record.origStatus != lead.RegulatoryItemWindow.Status.CLOSED && record.status == lead.RegulatoryItemWindow.Status.CLOSED);
    }
    return false;
    }
    });


    I have made the block bold where I am getting the error. The 'item' argument of the 'changed' function is showing null reference. I am not getting why. Please guide me through this.

    Thanks
    Akash

    #2
    First, make sure you are using the latest patched version (see smartclient.com/builds) of a recent version of SmartClient, on a supported browser. Then post all of those details.

    If you still have the problem, try renaming the field anything other than "selected". It may be possible that you are hitting a reserved property name in whatever browser you are using.

    Comment


      #3
      I am using SmartClient Version: v10.0p_2015-09-03/LGPL Deployment (built 2015-09-03) for my project.

      Comment


        #4
        Please re-read above post for next actions.

        Comment


          #5
          Hello Sir

          I tried changing the name other than 'selected' still I am getting the same error.

          Thanks
          AKash

          Comment


            #6
            Please read carefully, repeating ourselves wastes time and you do not have a support contract, so if you prove difficult to help, we will just move on to other issues where progress can be made more readily.

            You haven't tried the latest patched version.

            You haven't reported what browser(s) are affected.

            You also could check whether the error is reproducible in 10.1 or 11.0.

            Comment

            Working...
            X