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…

    https://jsfiddle.net/9otz8frh/2/

    Maybe someone with more experience can find a better way?

    Scott



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

    Scott



  • 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.

    Scott