How to re-init kartik-v editable rendered via ajax - yii2

I have set up a controller to renderAjax() and JS function to load() into a modal.
The problem occured upon re-opening the modal. I've searched through the issues in kartik-v github and he said that the Editable plugin needs to be reinitialized. Also he mentioned about a destroy() function.
How should I do it?

Related

asp:button reloads the page instead of firing OnClick event in Sitecore

I am using Sitecore and I have a header sublayout that I use in all pages. This layout contains a Logout button that fires OnClick event when clicked and executes the onclick event function. But in few pages it wont fire OnClick event at all instead it reloads the page.
Below is the code for the logout button
<asp:button id="btnLogout" runat="server" borderstyle="None" onclick="btnLogout_Click" text="Log out" ToolTip="Log out" backcolor="Transparent" style="cursor:pointer" class="logout_new"></asp:button>
Below is the code for the event function
protected void btnLogout_Click(object sender, EventArgs e)
{
Sitecore.Security.Authentication.AuthenticationManager.Logout();
Response.Redirect("/Login.aspx");
}
I found out that the difference between the pages where the logout fires the onclick event and pages where it does'nt is that they use the same header sublayout containing the logout button but they use different content sublayout though.
Note: I have not applied Cache to any sublayout.
Can anyone help me with this?
From the given context I don’t know what is the issue but here is what I will do if I have issue like this.
As you said only on few pages it is not working, it could be the other controls on that particular page is causing the issue.
I will pick two pages which has less controls on the presentation layer. Say PageA is a working page and PageB is a non-working page. Then I compare PageA and PageB and remove all common controls, this should narrow down the number of the controls on the presentation layer. Now check again to see if Page B is working or not. If not, I will try to remove one control at a time on PageB untill it starts working. If you find by removing certain control and the page started working then you can look into the particular control and identify the issue.
I hope this helps.
try disabling the cache as it would return the html without triggering the back end code.
To do so, one option is going to the presentation detail of those pages, find the control and click on it to edit. Under the "Caching section" uncheck "Cacheable" and publish the item. If this fixes your problem, I'd review the standard values of the template, to apply the change to all the items with the same template
This behavior happens to me at annoying times too, but it's almost always the same thing: the Sitecore sublayout the code is in is being cached.
The onclick javascript fires, but the page is not re-rendered with new content because the "unclicked" version is stored in the cache.
You'll need to disable caching on the sublayout to make the button work.
This can, however, be somewhat annoying if you're trying to cache as much presentation stuff as you can. In those cases, it often means you need to, counter-intuitively, create a number of "sub-sublayouts" and place them statically. Set the containing sublayout to be uncached, and then you can set each smaller one's caching appropriately (caching static parts, not caching dynamic stuff).
The problem was in the content sublayout in which it was not working, the Page_Load function was calling a Response.Redirect function to itself and it was not checking if it was a post back request or not before that. So Whenever a user clicked logout button it used to post it back to the server and the page used to reload instead of executing the onclick event.
I noticed that in the other content sublayout where it was working, it was checking if it was a post back or not.
I added a if(!IsPostBack) before that and it started working.

Content Dialog template in Visual Studio C#

I'm starting to learn Windows 8.1 phone development and I am trying to get the Content Dialog template to work inside a Pivot page. Work some reason, when I try to get the Add app bar button to navigate to the ContentDialog.xaml page, it is not displaying, but I see the navigate go to the ContentDialog constructor where the this.InitializeComponent() occurs.
I am finding very little online in way of examples on this template, so I am at a loss as to what I am missing. I understand that the ContentDialog page that was created from the template is inheriting from ContentDialog and not Page, but I'm not sure if this is still supposed to be directly accessed or if this XAML is supposed to be inside another "Page" XAML file.
Can someone please help.
The code looks like this in the Pivot page when the click event is selected:
Frame.Navigate(typeof(ContentDialog1));
I really haven't even touched the ContentDialog template from it's default yet, so it is set up like a set password page.
Thanks in advance
UPDATE
I found the answer to my question above. apparently, because it is a Content control, it needs to be called like a normal dialog would need to be called in it's code behind. I think my missconseption was that I thought it being "a template", that when I called it with the navigation calls that it would already have everything needed to get fired. You can also add the Content control to an existing page if you would like.
In either scenario, you need to add a method similar to this in your XAML.CS file.
private async void OpenDialog()
{
await this.contentStuff.ShowAsync();
}
You then need to call this method in the constructor. Then, when called, your dialog will appear.
Hope this helps others just starting out.

Why do html form inputs automatically get disabled?

I am using the RightJS javascript framework. I'm not sure if that has anything to do with this behavior or not. I have a form on my page and I use $('some_form').send(); to send the form to the server via a Post. The form submission works fine and request goes through to the server without error but after all the inputs in the form become disabled. Does anyone know what might be causing this to happen?
You need to run the preventDefault() function
$('form').send({
spinner: $('spinner'),
onComplete: preventDefault()
});
Its a jQuery feature

updatepanel never triggers the OnSelectedIndexChanged function when I use fullcalendar

I want to develop a fullcalendar based web, and all goes well until I met this question, I use a jQuery dialog when fullcalendar day click,and I plan to use updatepanel to make my dropdownlist linkage in jQuery dialog. But I found the OnSelectedIndexChanged function never triggered. I found when I add this code style="display:block"on the <div>, all code works well, when I use the jQuery dialog, the updatepanel never triggers the OnSelectedIndexChanged function.
So, is it means that I cannot use the updatepanel in the jQuery dialog?

Dynamic html onClick

So I am playing around with the HTML service of GAS.
It has been working fine (more or less). But I hit a wall now.
I want the script (inside the html file) to create some html on when called.
In particular a few tags.
However, I want those tags to have onClick handlers (which will edit the div element).
Now the problem is that the onClick should depend on certain properties and I can not
pre-create those objects, they have to be made pragmatically and for some reason when I add a
onClick="someFunction(elementID)" after the new code has been added to the old one the click handler disappears.
(it works tho if the handler function has no parameters)
eg.
var div="<div id=\"box"+count+"\" class=\"square\" insert></div>";
if(something)
div=div.replace("insert", "onclick=\"myFunction(box"+count+"\"");
This is intentional and documented: see the section called "Dynamically adding scripts or external CSS" in the HtmlService user guide.