Announcement

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

    Can I add custom contextMenuItem to headerContextMenu?

    Hi,

    SmartClient Version : v12.1p_2020-06-20

    is possible add a custom contextMenuITem to headerContextMenu? if possible, how can I do it?
    Attached Files

    #2
    Override getHeaderContextMenuItems, and call Super() to get the default items, then add yours.

    Comment


      #3
      Can you send sample code, please. I didn't find in SmartClient showcase.


      Code:
      getHeaderContextMenuItems :function(fieldNum){
               debugger;
               this.Super("getHeaderContextMenuItems", arguments);  ???
               console.log(fieldNum);
             }

      Comment


        #4
        You've already got it. Now the result of calling Super() is the result of the default implementation of getHeaderContextMenuItem(), an Array of MenuItem, and you can modify it and return whatever you want.

        Comment


          #5
          Ok thank. Sorry, I understood differently. :)
          I did it the way you said. Using the sample code, you can edit the menu as desired.

          Code:
           getHeaderContextMenuItems: function (fieldNum) {
                          let menu = this.Super("getHeaderContextMenuItems", arguments);
                          //menu.push({ isSeparator: true });
                          if (isChild)
                              return menu;
                          menu.push(
                              {
                                  title: ">Save Grid Settings",
                                  icon: "[SKINIMG]actions/save.png",
                                  click: function () { isc.say("Saved grid settings..!") }
                              }
                          );
                          return menu;
                      }

          Comment

          Working...
          X