Telerik Forums
Kendo UI for jQuery Forum
18 answers
1.5K+ views
Hi,

We have just started to use kendo ui async upload component in our application and I have some few questions regarding it.

1. I Is it somehow possible to customize the 'Select...' button (used to browse in the file systrem) in respect to the text and the color that changes at mouse over?

2. According to the documentation there is a cancel event which can be added in the configuration of file upload as:

$("#fileUpload").kendoUpload({
 async: {
  saveUrl: "upload_url",                            
  autoUpload: true,                                                
  removeUrl: "remove_url"
  },                      
  cancel: onCancel
  });

Though, onCancel method does not seem to be triggered when cancel upload button is pressed. Is is because that removeUrl must be specified? When cancel is activated Is it then through removeUrl that the so far uploaded file is deleted from server (that requires of course that a recourse at removeUrl does that actually), or how does it work?

Is it somehow possible to configure upload component not to show the cancel button?

thanks in advance, Piotr
mkhalesi
Top achievements
Rank 1
Iron
 updated answer on 20 Aug 2022
1 answer
555 views

I have a grid with the drag and drop feature and locked columns. I have a need for the row to be dragged up and down in the grid. I found an article on your site but it does not really work, even in your own Dojo. It only allows dragging to the top and should allow dragging anywhere. It doesn't leave a gap on the unlocked side of the table as would be expected. I would like it to clone the existing row and use that as a placeholder on both sides of the grid. Also, the column widths are not preserved.

Below is a link to the article: https://docs.telerik.com/kendo-ui/knowledge-base/grid-drag-drop-with-locked-columns

Article

Update:

Here is some code that I currently have which fixes the issue with the column widths and the dragging to the top only. It doesn't address the issue with the placeholders though.

function enableKendoGridLockedDND(gridElement) {
    if (!gridElement) {
        gridElement = ".k-grid";
    }
    let grid = $(gridElement).data("kendoGrid");
    if (!grid.lockedTable) {
        return false;
    }
    let gridWidth = $(gridElement).width();
    let lockedWidth = $(gridElement).find(".k-grid-header-locked").width() || 0;
    let unlockedWidth = $(gridElement).find(".k-grid-header-wrap table").width() || 0;
    let tableWidth = lockedWidth + unlockedWidth + 2;
    grid.lockedTable.kendoSortable({
        axis: "y",
        filter: ">tbody >tr",
        hint: function(element) {
            var unlockedPortion = grid.table.find("tr[data-uid=" + element.data("uid") + "]").children();
            let table = $(`<div style="overflow: hidden; width: ${gridWidth}px;"><table style="background: whitesmoke; width: ${tableWidth}px;" class="k-grid k-widget"></table></div>`);
            let colgroups = $(gridElement).find(".k-grid-header colgroup");
            let colgroupWidths = [];
            $.each(colgroups, function (index, group) {
                $.each($(group).children(), function (index2, child) {
                    colgroupWidths.push($(child).css("width"));
                });
            });
            table.find("table").append(element.clone().append(unlockedPortion));
            $.each(table.find("td"), function (index, col) {
                $(col).css("width", colgroupWidths[index]);
            });
            console.log(table);
            table.css("opacity", 0.7);
            return table;
        },
        cursor: "move",
        placeholder: function (element) {
            return element.clone().css({
                "opacity": 0.3,
                "border": "1px dashed #000000"
            });
        //    console.log("placeholder", element);
        //    var unlockedRow = grid.table.find("tr[data-uid=" + element.data("uid") + "]");
        //    var unlockedPortion = unlockedRow.children();
        //    console.log(element);
        //    return element;
        //   // return $(`<tr class="w-100 grid-placeholder" style="background: green;"><td>Hello World</td><td></td><td></td></tr>`);
        },
        //move: function (e) {
        //    let event = e.draggableEvent;
        //    console.log("event", event);
        //    let item = e.item;
        //    let itemUID = $(item).data("uid");
        //    console.log("UID", itemUID);
        //    console.log("item", item);
        //    let unlockedDraggingRow = grid.table.find("tr[data-uid=" + item.data("uid") + "]").children();
        //    console.log(unlockedDraggingRow);
        //    console.log("clone", unlockedDraggingRow.clone());
        //    let target = e.target;
        //    let unlockedTargetRow = grid.table.find("tr[data-uid=" + target.data("uid") + "]");
        //    $(gridElement).find("tr.d-none").removeClass("d-none");
        //    $(gridElement).find("#dragPlaceholderRow").remove();
        //    $(grid.table.find("tr[data-uid=" + target.data("uid") + "]")).before(`<tr id="dragPlaceholderRow"><td colspan="6">Yo!</td></tr>`);
        //    $(unlockedTargetRow).addClass("d-none");
        //},
        end: function (e) {
            let skip = grid.dataSource.skip() || 0;
            let newIndex = e.newIndex + skip;
            let dataItem = grid.dataSource.getByUid(e.item.data("uid"));
            grid.dataSource.remove(dataItem);
            grid.dataSource.insert(newIndex, dataItem);
        },
        change: function(e) {
            let skip = grid.dataSource.skip() || 0;
            let newIndex = e.newIndex + skip;
            let oldIndex = e.oldIndex + skip;
            let data = grid.dataSource.data();
            let dataItem = grid.dataSource.getByUid(e.item.data("uid"));
            console.log("skip", skip);
            console.log("newIndex", newIndex);
            grid.dataSource.remove(dataItem);
            grid.dataSource.insert(newIndex, dataItem);
          }
        });
}

Here is what the change event returns:


action: "remove"
draggableEvent: {originalEvent: MouseEvent, type: 'mouseup', target: span.k-icon.k-i-reorder, currentTarget: fn.init(1), isDefaultPrevented: ƒ, …}
isDefaultPrevented: ƒ ()
item: fn.init [tr.k-alt.k-master-row]
newIndex: -1
oldIndex: 1
preventDefault: ƒ ()
sender: init {element: fn.init(1), _events: {…}, options: {…}, draggable: init, draggedElement: fn.init(1), …}
_defaultPrevented: false

Lee
Top achievements
Rank 2
Bronze
Bronze
Bronze
 updated answer on 19 Aug 2022
0 answers
1.2K+ views

I've reviewing the code Binding to remote data example for the ListView control. There's some HTML which I don't understand. It might be some HTML5 code snippets I'm unaware of, or it might be something specific to Kendo UI for jQuery. In any case I'm sorry for my ignorance. 

Here's a compact example from I'm referring to:


    <script type="text/x-kendo-template" id="template">
        <div class="product">
            <img src="../content/web/foods/#= ProductID #.jpg" alt="#: ProductName # image" />
            <h3>#:ProductName#</h3>
            <p>#:kendo.toString(UnitPrice, "c")#</p>
        </div>
    </script>

In the code snippet the src attribute has "../content/web/foods/#= ProductID #.jpg" and the alt attribute has "#: ProductName # image". I get that there's a substitution going on, but I don't understand why the src attribute using #= and the alt attribute doesn't. Why does it use #: ? 

What's the difference between the two and when do you use one other the other?

Rod
Top achievements
Rank 1
 asked on 19 Aug 2022
0 answers
111 views

Hi,

I have custom column which contains buttons, how to select the entire row when I focus on the button control?

Thanks.

lucerias
Top achievements
Rank 1
 asked on 19 Aug 2022
0 answers
408 views

Hi all,

How to apply Alternate category background color on TreeList, for example, column A is the category column, which has the parent and child data, how to apply grey color to only column A of the first category and apply orange to the next category? How to make it to be dynamic alternate styling?

Thank you.

lucerias
Top achievements
Rank 1
 asked on 19 Aug 2022
0 answers
207 views

We're still getting used to using Telerik's Kendo UI for jQuery. So far, we've only used one component, AutoComplete. Which works great, BTW!

There's something we'd like to do, but don't know how to do. On an ASP.NET MVC Core page (.NET 6) we want to be able to allow the user to enter multiple items of the same type. It seems like either the Grid or ListView Kendo components would work. Personally, I'm favoring the ListView. But we also need to use AutoComplete work when the user is entering values to a new row. So, for example, we need to collect LotNumber and ProgramName, multiple times, because there can be and often is, multiple items to be entered, along with other details on the same page. I've looked at the ListView component, the Add method, etc. In the example given, it references an identified (by using the HTML id property) control on the page. So, how does one apply AutoComplete to both LotNumber and ProgramName, when entering a new LotNumber/ProgramName pair in a ListView?

Rod
Top achievements
Rank 1
 asked on 19 Aug 2022
1 answer
104 views

I want the editor to open up with the "Title" field pre-focused and with the "No title" text selected. 

the below code does not seem to be working.

I am using a custom edit template

 edit: function (e) {

                var input = e.container.find("title");
                input.select();
                input.focus(function (e) {
                    input.select();
                });

                input.focus();

}

 

 

Neli
Telerik team
 answered on 18 Aug 2022
2 answers
108 views

Hello,

I'm currently applying the Table Wizard button to a custom Sitefinity widget; I'm looking to make the table header NOT bold. Is that something someone could guide me or help me with?

Thanks in advance,

Sunny Carrandi

Sunny
Top achievements
Rank 1
Iron
 updated answer on 17 Aug 2022
0 answers
1.0K+ views

I have a kendo grid and I need to set one of the columns to a fixed width that is always exactly 120px. My issue is that if the screen is wider than the total set width of all of the columns it starts expanding the columns. This is good for everything except my one column that needs to always be the same. I also tried leaving the width off of one of the columns. The problem with that is that when the screen is narrow (like a phone or tablet) the column without a set width disappears. Another trick I tried is using the template to wrap the column in a span tag with a fixed width, however that just overflows the cell. How do I solve for this?

Dojo: https://dojo.telerik.com/iDUtIvow

Lee
Top achievements
Rank 2
Bronze
Bronze
Bronze
 updated question on 16 Aug 2022
0 answers
104 views

when we have the search option enabled for DDL we cant make a selection using keyboard & typeing the first letter (without expanding the drop down)

 

are there workaround to make it work togather?

Aleksandr
Top achievements
Rank 1
Bronze
Bronze
Veteran
 asked on 16 Aug 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?