QPopupEdit how to pass own argument?

  • I use the popup component and there is @save event in my case it’s @save=“saveCellEditPopup”. By default there are two arguments (val, initialValue) that I can get in my saveCellEditPopup function but I need to add one more argument with id of the model’s element… how can I do this?

    I tried several variants:

    1. @save=“saveCellEditPopup(val, initialValue, props.row.id)”
      I get val == id and others are undefined;

    2. @save=“saveCellEditPopup(props.row.id)”
      I get id==id but val and initialValue are undefined;

    Is there any way to solve this?
    It will be very strange if it’s not…

  • The component’s emit of the save event only sends the two arguments. So, trying to get a third out of it simply won’t work.

    However, with refs, you can get what you want in a backwards ass way I guess. It isn’t the cleanest thing to do, but it should work. I think. Hehehe…


    Maybe someone with more experience can find a better way?


  • Thinking about it more, I am less certain it will work. But, maybe it will. Try your luck. 😄


  • Thinking some more…

    It should work… 😄

    Obviously, you’ll have to come up with some sort of ref that includes the value, but is still unique for each field, to get the right id. The “key” (haha pun not intended), is adding the value, but the ref being still unique. So, I think that should get you on your way.


  • Hi.
    You can see solution in https://github.com/quasarframework/quasar/issues/2747
    I think in your case it will be
    @save="(val, initialValue) => saveCellEditPopup(val, initialValue, props.row.id)"

  • yep, that’s what i’ve been struggling to find too avoiding two way binding to get proper handle on the value. i’m always reluctant to use refs or any dom way coz it seems hacky, but gotta do most of the time specially on edge cases shrugs.

Log in to reply