Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
360
iggrid Button Errors in angular 2
posted

Hi,

Currently i am using iggrid in my angular 2 project , i am getting following issues while implementing iggrid in my project

1).on iggrid, i have a button called viewparcels, currently when i have click on viewparcels button editbox get invoked, in my case it should not be invoke when i would click on that button,
but when i would click on other cell values then editbox should get invoke. Please check below screenshot

ERROR:on viewpurchase button click event editbox get invoked..

2).i have called function RedirectParcel on viewparcels button click event, but when i click on button , its giving the following error.

Uncaught ReferenceError: RedirectParcel is not defined
at HTMLInputElement.onclick

Please check below screenshot

Columns

function


3). i am using generatePrimaryKeyValue: function (evt, ui) for getting new id while adding new row, but its not working properly.
For e.g i have 3 rows with ID:175,177,179 . in this case when i click on add new row,the new id should be 180, but it returning new ID is 176.

Please Find below screenshot

Generate Wrong primary key

Thanks,

Yogesh

Parents
No Data
Reply
  • 3995
    Verified Answer
    Offline posted

    Hello Yogesh,

    1) Clicking on any cell will trigger editing, when you are in edit mode row. You can bind to editRowStarting and cancel the editing when the current target is the ViewParcel column.

    features:[

      {

        name: "Updating",

        editRowStarting: function(evt, ui){

          if($(evt.currentTarget).attr("aria-describedby") === ui.owner.element.attr("id") + "_ViewParcel") {

            return false;

         }

       },

       columnSettings: [

           { columnKey: "ViewParcel", readOnly: true }

       ]

      }

    ]


    2) Function RedirectParcel is expected to be defined as global function. Make sure it is defined and it is defined globally.


    3) From generatePrimaryKeyValue API docs you can see that the ui.value is auto-generated in the following way - the number of records in the data source + 1

    If your primaryKey values are not auto-incrementing you can specify them as ui.value

    For example:

    generatePrimaryKeyValue: function(evt, ui) {

      //specify it however you want, just make sure they are unique

      window['yourOwnPK'] = window['yourOwnPK'] ? window['yourOwnPK'] : 180;

      ui.value = window['yourOwnPK']++;

    },

Children