Announcement

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

    Field type: boolean does not trigger an event on clicking

    Hello Sir,

    I am using Smart Client V10.0 for my project. I have been stuck in a phase where I need to change the value of a ListGrid field of type: "select" on clicking another field of type: "boolean" on the same List grid. I have pasted the code below. I will really appreciate if you can give me a helping hand in this. I have highlighted the code which depicts the fields I am referring. I want the status field should change its value as I tick the boolean checkbox in my selected field. Currently, its not changing as I am clicking the checkbox . Rather. if I'm clicking outside the checkbox,then its getting activated and then its changing the value of the status.

    Code:

    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 will really appreciate your help in this. I am stuck in the mid of project execution due to this bug. Thanks in anticipation!

    Regards,
    Akash Mohapatra

    #2
    You already posted this and already received corrections which you have not applied.

    Careful about doing this. Duplicate posts and ignoring feedback will get you banned.

    Comment


      #3
      I applied the changes that you said i.e using itemGridRowNum() rather than item.rowNum but that didnot give any different result. Morevoer, I cannot upgrade my smartClient version to 11 because if I do so my whole project will be affected. I kinda do this changes in the smartClient V10.0. Sorry if I missed out some of your points. The one that got solved is a different project and different code. I will appreciate your helping hand.

      Thanks

      Comment


        #4
        Please read the FAQ. No one can run your code to see the issue, and the code is only partial, so there are many things that could be the problem that we can't see. You need to post a minimal, runnable test case.

        Comment

        Working...
        X