Announcement

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

    Is there any alternative to the functionality of changed() in ListGridField?

    Hello Sir

    I am wanted to create a grid with a 'STATUS ' and 'SELECT' column. I want to 'SELECT' column to be checkbox. Upon selecting the checkbox, I want the status to be changed in the GRID. I have tried to do it in using changed() , but its not working as per the requirement. Is there any other to do it. I will appreciate if you can guide me through this.

    Thanks
    Akash

    #2
    This question cannot be answered, because you haven't stated your requirements or approach. It's not impossible to provide an alternative to something which has not been specified.

    Comment


      #3
      i woudl always suggest you show your sample code especially the function you are overwriting

      it is unclear what you mean with STATUS

      if you are talking about a trigger for a checkbox i would refer you to this example in the samples
      http://www.smartclient.com/#checkboxSelect

      to capture the check and uncheck of a checkbox it uses "selectionUpdated" which can be adapted to your use case

      Comment


        #4
        Thanks for the advice! Yeah, I saw the code of that example. I am using Smart Client V10.0P (cannot upgrade since my project is already built on that environment). In my grid, I have two columns named 'Selected' and 'Status'. I want the status should change when single clicking inside the checkbox. In the below highlighted code, when executed displays check boxes but by single clicking on it does not change the status rather I have to click just outside the box first to activate it and then click inside the box to change the status. Hence, I was thinking to replace the changed method with some other command which would function in the similar way. I will appreciate your help.

        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,
        valueMap: ["true", "false"],
        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()}
        ]
        }
        ]

        Comment


          #5
          You probably want to see the doc for ListGridField.canToggle

          Comment


            #6
            Thank you! Do you have any sample/example to see the usage of this functionality?

            Comment


              #7
              When I clicking the checkbox, an error pops out in the developer console as below:

              11:42:48.407:pointerup0:WARN:Log:TypeError: Unable to get property 'grid' of undefined or null reference
              Stack from error.stack:
              changed () @ project:97:1074
              Class.fireCallback ()
              Class.fireCallback ()
              ListGrid.rowClick ()
              Function code () @ Function code:2:89
              GridRenderer._rowClick ()
              Class.invokeSuper ()
              Class.Super ()
              GridBody._rowClick ()
              GridRenderer.click ()


              Clueless about this. Please help!

              Comment


                #8
                Any idea guys on the above error?

                Comment

                Working...
                X