Okay, so I have a grid that is used to manage Users. I would like to have two edit-popup buttons,
1.) For changing the user's password
2.) For changing the rest of the user's information
I currently have 1 command.Edit() button that has a custom template specified in ".Editable" that works fine with changing the user's information.
I would like to have a second button that is associated with a different template that changes the user's password.
I thought that this could be achieved through a Command.Custom() button; however, I'm not sure how I'd hook it up to the Grid's edit event.
Is this even possible? If not, is there any known workaround to achieve this functionality?
5 Answers, 1 is accepted
So, I just thought of a possible solution. If I have two "command.Edit()" buttons, one for changing the password and one for changing the rest of the user information. Like so,
I then define a template defined in Editable like so,
I subscribe to the Edit Event like so,
Could I add logic in the "onEdit" function to determine which Edit button was pressed? If so how would that logic look?
Any help is greatly appreciated! Thanks.
I am afraid that the described behavior is not available out of the box. However, you can implement it with a bit of additional code.
You can define a custom popup editor and wrap the editors in div elements that will be conditionally hidden when necessary. The popup editor can be roughly structured like below:
Then, you can specify custom command buttons:
The Click handlers for each custom command will set a global variable that will determine what part of the editor will be visible to the user:
Finally you can handle the Grid edit event and hide/show the relevant parts of the editor:
Give the appraoch a try and let me know how it works for you.
Thank you for the help! I implemented your suggestion, and it works except for the password fields are autofilled with some erroneous data that I'm assuming might be the user information that I hid. Any idea how I could resolve this? Here is my current implementation:
I've also attached some screenshots to give a visual representation of how it looks. Note: everything validates fine, but the password fields are autopopulated with erroneous data and instead I would like for them to be empty.
Solution: I ended up just setting the password fields manually to override it, like so:
Thanks for all the help!