ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Hide a Button / Set Title dynamically PopupForm
Title:
B
I
{code}
?
I'm using the delete popup form in grid and the delConfirmLoad function (introduced in 4.9). I think that's the good place to check an another parameter and hide a button or set popup title dynamically (just like a message returned from controller). How can I access the elements (e.g. Titlebar) in the popup form? Is this possible at all to hide/show the buttons dynamically?
Save Changes
Cancel
TT Tom
asked at 16 Nov 2015
Answers
B
I
{code}
?
InitPopupForm has extensions for title and buttons there's .Title("my title") and .UseDefaultButtons(false), to hide the default buttons (Ok, cancel) .Button(text, clickFunc) to add a button --- you can do this dynamically in the awe.open call, so the format could pseudo look like this: awe.open('{0}', {{ params:{{ id: '.{1}' }}, udb:0, p: {{ t:'my title' }}, b:['btn1', btn1func, 'btn2text', btn2func] }}) // double {{ because it's string.format; udb use default buttons false note that your Ok button needs to submit the form inside the popup, so it can look like this: function myOk() { $(this).find('form').submit(); }
Save Changes
Cancel
Omu
answered at 16 Nov 2015
Thanks a lot. Will check later if that works. For now I solved it by returning a PartialView using another view with Popup
at 16 Nov 2015
TT Tom
still looking for a smart solution. Returning different PartialViews works only under specific conditions. The awe.open Popup call is populated for all rows in grid, so there will be always the same popup (same title, same buttons) for each row. But in my case some of the rows are specific, and for this rows I'd like to display a different popup with e.g. only one button or other dialog title.
at 17 Nov 2015
TT Tom
I tried already many tricks but none of them satisfied me, moreover works at all. If it's not possible to use different popups, one of my idea was to remove an element by 'id' in js in the view I return from controller. But i found no id in OK button element. Any other ideas?
at 17 Nov 2015
TT Tom
in the format you can use .Prop, so it could be t:' sure delete .Name ?'; also besides ClientFormat = string you can use ClienFormatFunc = jsfunc(rowmodel) where you return a string (".. t: 'sure delete " + o.Name +...)
at 17 Nov 2015
Omu
Nearly want to shout out "Yeah, ClientFormatFunc rocks!!!", nearly! Indeed clientFormatFunc did the trick. The fly in the ointment is, that the status of the record can change during the user browses the grid. So maybe in next releases any modifications to access awe elements by Id?
at 17 Nov 2015
TT Tom
not exactly sure what is the problem, regardless, you can access the grid by id, and the row by key, also you have the row model as a parameter in the func
at 17 Nov 2015
Omu
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK