in kendoForm i can't find the submit button to rename from submit in save.
SampleCode: https://dojo.telerik.com/EkEXENEL
kendo.ui.Form API Reference: https://docs.telerik.com/kendo-ui/api/javascript/ui/form
You can use buttonsTemplate
$("#exampleform").kendoForm({
orientation: "vertical",
buttonsTemplate: '<button class="k-button k-primary k-form-submit" type="submit">Save</button><button class="k-button k-form-clear">Clear</button>'
...
Example: buttonsTemplate
Documentation: buttonsTemplate
Related
I don't want the modal to close when I click the 'cancel(delete)' button, only when losing focus or close button is clicked. How can I prevent closing?
The default cancel button is for closing the dialog. instead of hacking that button for another task, you can add custom buttons as html, and handle their click events manually: (Run it live)
var onBtnClicked = (btnId) => {
// Swal.close();
alert("you choosed: " + btnId);
};
Swal.fire({
title: "What you want to do?",
icon: "warning",
showConfirmButton: false,
showCloseButton: true,
html: `
<p>select an action</p>
<div>
<button class="btn btn-primary" onclick="onBtnClicked('reply')">Reply</button>
<button class="btn btn-danger" onclick="onBtnClicked('delete')">Delete</button>
</div>`
});
I have change Header cart in formation like remove cart icon and add
HTML tag on it.
language/english/common/cart.php
$_['text_items'] = '<p>Mycart</p><span><em>%s</em> item(s) - %s</span>';
common/cart.tpl
<button type="button" data-toggle="dropdown" data-loading-text="<?php echo $text_loading; ?>" class="btn btn-inverse btn-block btn-lg dropdown-toggle"><!-- <i class="fa fa-shopping-cart"></i> --><span id="cart-total"><?php echo $text_items; ?></span></button>
It work fine but when i click on addtocart button it load using Ajax
and the previous modified cart tags reset to default. when refresh it
again work. any one knew about this.
It is happened due to when we click on addtocart button on product
detial page it will call call function on click event and load
checkout/cart using ajax so we need to make synchronize common/cart
information and chekout/cart infourmation
I solve the issues as
follows:
in product.tpl or other page where you add addtocart
inside
$('#button-cart').on('click', function() {
we will find
if (json['success']) {
$('.breadcrumb').after('<div class="alert alert-success">' + json['success'] + '<button type="button" class="close" data-dismiss="alert">×</button></div>');
$('#cart > button').html('<!--<i class="fa fa-shopping-cart"></i>--> ' + json['total']);//here you can get the cart icon and comment out he icon code
$('html, body').animate({ scrollTop: 0 }, 'slow');
$('#cart > ul').load('index.php?route=common/cart/info ul li');
}
for add other tag inside cart info modify on
language/english/checkout/cart.php
$_['text_items'] = '<p>Mycart</p><span><em>%s</em> item(s) - %s</span>';
and it work for me
My kendo template is as follows:
<div id="file-err-msg" > Please remove files with errors</div>
<input name="files" id="files" type="file" />
<script id="fileTemplate" type="text/x-kendo-template">
<span class='k-progress'>
</span>
<strong class='k-upload-status'>
<button type='button' class='btn-remove k-button k-button-bare k-upload-action'>
<span class='k-icon k-i-close k-delete' title='Remove'></span>
</button>
</strong>
</script>
<script>
$("#files").kendoUpload({
template: kendo.template($('#fileTemplate').html())
});
</script>
I need to hide the div with id - file-err-msg, when the remove button is clicked. the Remove action is happening when the span with css class "k-delete" is clicked. I need to add the below event handler in addition, and it is never being called.
$(".k-delete").click(function () {
alert("Remove button clicked");
});
since these controls are rendered dynamically, i tried to bind them to the event handler as below, but nothing works.
$("body").on("click", ".btn-remove", function () {
alert("dynamic control event handler");
});
Any help is appreciated!
According to Kendo Upload API documentation, you can bind a function to the remove event.
So this is where you could hide your file-err-msg div :
$("#files").kendoUpload({
template: kendo.template($('#fileTemplate').html()),
remove: function(e) {
$('#file-err-msg').hide();
}
});
I have a problem regarding the bootstrap tooltip on ajax loaded content.
I know there are other answers but it doesn't seem to work for me and i tried alot of methods.
First i am initializing the bootstrap tooltip using this code:
$(document).on('ready', this, function(e){
$("[rel='tooltip']").tooltip();
});
Which works great on normal content but not on ajax.
Secondly i have found here that i need to add a selector so i added a class to the ajax loaded content in this form:
<button data-toggle="modal" rel='tooltip' data-placement="top" data-original-title="View Supplier Details" data-target="#view-supplier" type="button" class="btn btn-success view-supplier btn-xs margin-left-5 tooltip-aj">
And modified the call of the tooltip to the following:
$(document).on('ready', this, function(e){
$("[rel='tooltip']").tooltip({
selector:'tooltip-aj'
});
});
But still can't get it to work. Can somebody please help me.
Regards!
Ok i found an answer just after i posted the question:
Here it is, as it is a bit frustrating sometime:
$('body').tooltip({
selector: '[rel=tooltip]'
});
Just add this DEMO
<button data-toggle="modal" rel='tooltip' data-placement="right" data-original-title="View Supplier Details" data-target="#view-supplier" type="button" class="btn btn-success view-supplier btn-xs margin-left-5 tooltip-aj">
$('body').tooltip({
selector: '[rel=tooltip]'
});
Thanks to Mystic Jay
Please find below my code:
Template of customer search form
<script type="text/x-kendoui-template" id="customer-search-view-template">
<div class="searchform" id="searchCustomer">
<form class="frmSearch">
<input name="searchTxt" data-bind="value: customerName" class="k-textbox" />
<button class="k-button" data-bind="click: searchClicked">Search</button>
<button class="k-button" data-bind="click: newClicked">New</button>
</form>
</div>
</script>
customer-search.js where loading above template and creating viewmodel object
$(function(){
var views = {};
templateLoader.loadExtTemplate("customer-search-view-template", "../views/customer-search-template.html");
var layout = new kendo.Layout($('#customer-search-view-template').html());
layout.render($("#main"));
// Create an observable view model object.
var customer = kendo.observable({
customerName: "John",
searchClicked: function() {
this.set("customerName", "Search clicked");
},
newClicked: function() {
this.set("customerName", "New clicked");
}
});
// Bind the view model to the personFields element.
kendo.bind($('#searchCustomer'), customer);
});
When I click the search button, the text is set in the textbox but this also refresh the page with ?searchTxt=Search+clicked in the address bar.
May I know why this button click refresh the page and how do I stop refreshing the page on button click ???
I would try and place the attribute 'type' for each like so:
<button type="button" class="k-button" data-bind="click: searchClicked">Search</button>
<button type="button" class="k-button" data-bind="click: newClicked">New</button>
The page thinks that each are performing a form submit action, but by placing the type attribute, you can access the event you intended for search. You may not need your form tags if you are not going to post any data, but rather just a js event handler. Good luck.
The reason is that you are inside a <form>, which has no settings (URL, method, etc), so the browser's default behavior is probably to perform a GET to the current URL (which is a refresh). You could just use <div> instead of <form> if you just want to execute that method.