Telerik Forums
Kendo UI for jQuery Forum
2 answers
843 views

We want to filter all grid columns by a single input-field. When we define the type of one column as number, the filter doesn't work.  

http://dojo.telerik.com/@brandung/uTaGE/5

Rahul
Top achievements
Rank 1
Iron
 answered on 19 Apr 2022
1 answer
156 views

Hello Eveyone

Our company use Kendo Window to present content.

But the user keep Open and Close and Open....

It's cause the memory leak.

Is any way to slove this problem?

Thanks all.

Neli
Telerik team
 answered on 15 Apr 2022
6 answers
2.2K+ views
Hi Alexander/Telrik -

I would like to know if there is a way to see if the switch is either checked or unchecked?

Basically something like: ON || OFF

if switch.OFF:then run this.function()
If switch.NOT.OFF run that.function();


I had a look at your examples on the demo page but only show a console.log("Checked?Unchecked")
Which toggies with the switch but doesn't allow binding a specific event to the status of a switch.

Thanks in advance.



John
Top achievements
Rank 2
Iron
Iron
Veteran
 answered on 14 Apr 2022
3 answers
223 views
Having a treeview with images for each node, I tried changing the image for the node upon selection using the following event handler:
function onSelectNode( e )
{
    var dataItem = this.dataItem( e.node );
    dataItem.imageUrl = "someImage.png";
]
While stepping it appears that dataItem.imageUrl has been changed, however the treeview does not show the new image.
How can I get the new image to show?
Andrea
Top achievements
Rank 1
Iron
 answered on 14 Apr 2022
7 answers
1.4K+ views

Hello,

I am wondering if there is UI kit for Adobe XD available for download.

Valentin
Telerik team
 answered on 14 Apr 2022
1 answer
128 views

Hi,

I need the legend to be scrollable because when there's too many items things begin to overlap.

Is there any way to make the legend scrollable.

 

Nikolay
Telerik team
 answered on 13 Apr 2022
1 answer
342 views

Hey guys,

Here's the thing, I have a dropdownlist populated already (use datasource in case this info is needed, since the info comes from an endpoint) and it has to be this function so that the user types anything (on an input generated by the method "filter" )and the data gets filtered, but i want to do it at the client side so in that case i wouldn't have to change any c# code. So i found out there's this method "filtering" but i didn't found an example of how to apply it, so i'm here in looking for any guidance. 

 

Hope you understand my doubt.

 

Regards.

Neli
Telerik team
 answered on 13 Apr 2022
1 answer
912 views

Hello,

 

I'm using a kendoMenu item as a toolbar option in a kendo grid. This worked fine until one of the newer releases and the animated dropdown panel now shows behind the grid as shown here:

https://jsfiddle.net/k1d4aufr/

Previous versions of kendo did not have this problem:

https://jsfiddle.net/jddevight/Ltgvk2sf/

 

I've tried setting the z-index on the animated panel and nothing works. Any ideas?

 

Thanks,

 

Matt

 

Georgi Denchev
Telerik team
 answered on 13 Apr 2022
1 answer
144 views

I would like to create a custom filter for a kendo ui grid with the following requirements:

  1. The column is a date.
  2. There are other filterable columns that are not necessarily dates.
  3. The filter dropdown should not be unnecessarily complex. There should be a startDate, endDate, filter, and clear buttons. No other dropdowns (no "and", "greater than", "less than", etc).
  4. The filter should be in a dropdown menu from the column and not a separate row.
  5. The dataSource is a JSON object.
  6. The date in the JSON object is in this format: "2022-04-12T00:00:00".
  7. When the user clicks the clear button in the dropdown and then tries to filter again it should still work as expected.

I tried following this Dojo: https://dojo.telerik.com/EVEwuREK but it only got me part way there as I do not know how to override the filter button and include the filters from the other columns. In this example, there is no submit or clear button so if the user enters dates they can't bet back to the full list and if they filter by column that filter gets cleared when filtering by date. It also produces unexpected results depending on whether you filter by country or date first. 

I made a sample Dojo here which shows the bug with filtering: Dojo

Steps to Reproduce:

  1. Go to the Dojo and click run.
  2. Click the birthday filter.
  3. Choose 1/1/1980 - 1/1/1989 and click filter
  4. Observe that the correct entry is displayed.
  5. Click the filter on the birthday field again.
  6. Click Clear (observe that all 3 records are now shown as expected)
  7. Click the birthday filter again.
  8. Choose the same dates as before 1/1/1980 - 1/1/1989 and click filter.
  9. Notice this time 2 records are showing and neither fall inside that date range.
Lee
Top achievements
Rank 2
Bronze
Bronze
Bronze
 answered on 12 Apr 2022
0 answers
233 views

I am having an issue with the breadcrumb feature in the File Manager widget. No matter which breadcrumb link I click, it always takes me to the home directory. When I inspect the link, href is set to "#" for all of them. I'm not sure what I'm missing to make this work correctly. I've included my javascript, controller, and view. If other code is needed I can provide it. Thanks in advance for any help!

Javascript:

function loadFileManager() {

	$("#fileManager").kendoFileManager({
        draggable: false,
        resizable: true,
        dataSource: {
            transport: {
                read: {
                    url: $('#urlHolders').data('readFilesUrl'),
                    method: "POST"
                },
                create: {
                    url: $('#urlHolders').data('createFileUrl'),
                    method: "POST"
                },
                update: {
                    url: $('#urlHolders').data('updateFileUrl'),
                    method: "POST"
                },
                destroy: {
                    url: $('#urlHolders').data('destroyFileUrl'),
                    method: "POST"
                }
            }
        },
        uploadUrl: $('#urlHolders').data('uploadFileUrl'),
        toolbar: {
            items: [
                { name: "upload" },
                { name: "sortDirection" },
                { name: "sortField" },
                { name: "changeView" },
                { name: "spacer" },
                { name: "details" },
                { name: "search" }
            ]
        },
        contextMenu: {
            items: [
                { name: "rename" },
                { name: "delete" },
                { name: "download", text: "Download", command: "DownloadCommand", spriteCssClass: "k-icon k-i-download" }
            ],
            open: function (e) {
                //Executes when an item is right-clicked, before the context menu opens
                //We only want context menu actions to be available for files, not folders. So we intercept that here

                //Check whether the clicked item was a treeview item (folder)
                var isTreeviewItem = $(e.target).hasClass('k-treeview-item');

                //Check the clicked item for the folder icon class
                var isFolder = e.target.querySelector('.k-i-folder') != null;

                //if the clicked item a folder, do not open the context menu
                if (isTreeviewItem || isFolder) {
                    e.preventDefault();
                }
            }
        }
    });	

	var fileManager = $("#fileManager").getKendoFileManager();

	fileManager.executeCommand({ command: "TogglePaneCommand", options: { type: "preview" } });
	fileManager.toolbar.fileManagerDetailsToggle.switchInstance.toggle();

	var filemanagerNS = kendo.ui.filemanager;

	filemanagerNS.commands.DownloadCommand = filemanagerNS.FileManagerCommand.extend({
		exec: function () {
			var that = this,
				filemanager = that.filemanager, // get the kendo.ui.FileManager instance
				options = that.options, // get the options passed through the tool
				target = options.target // options.target is available only when command is executed from the context menu
			selectedFiles = filemanager.getSelected(); // get the selected files

			window.location = '/FileManager/Download?path=' + selectedFiles[0].path;

		}
	});
 
}

View:

<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
    <h1 class="h2">File Manager</h1>
</div>

<div id="fileManagerContainer" class="wrapper">
    <div id="fileManagerContent">
        <div id="fileManager" class="rounded"></div>
    </div>
</div>

@section scripts {

    <script type="text/javascript">
        $(function () {
            loadFileManager();
        });

    </script>
}

Controller:

public class HomeController
{

	private readonly FileContentBrowser directoryBrowser;
	private const string contentFolderRoot = @"C:\Users\anna\Desktop\FileManagerContent";

	public HomeController(IPatientListService patientListService)
	{
		directoryBrowser = new FileContentBrowser(patientListService); // Helper utility for the FileManager controller
	}

	public ActionResult Index()
	{
		_auditService.LogEvent(new AuditEventModel
		{
			EventDef = EventDefinitions.PageOpened,
			EventItemName = AuditHelper.PageOpenedEventItemName(this.ControllerContext.RouteData)
		});

		return View("Index");
	}

	#region File Manager
	/// <summary>
	/// Gets the valid file extensions by which served files will be filtered.
	/// </summary>
	public string Filter
	{
		get
		{
			return "*.*";
		}
	}

	public JsonResult Read(string target)
	{
		var path = (string.IsNullOrWhiteSpace(target)) ? contentFolderRoot : target;
		int userId = User.Identity.GetUserId();

		try
		{
			directoryBrowser.Server = Server;

			var result = directoryBrowser.GetFiles(path, Filter).Concat(directoryBrowser.GetDirectories(path, userId));

			return Json(result, JsonRequestBehavior.AllowGet);
		}
		catch (DirectoryNotFoundException)
		{
			throw new HttpException(404, "File Not Found");
		}

		throw new HttpException(403, "Forbidden");
	}

	/// <summary>
	/// Updates an entry with a given entry.
	/// </summary>
	/// <param name="target">The path to the parent folder in which the folder should be created.</param>
	/// <param name="entry">The entry.</param>
	/// <returns>An empty <see cref="ContentResult"/>.</returns>
	/// <exception cref="HttpException">Forbidden</exception>
	public ActionResult Update(string target, FileManagerEntry entry)
	{
		FileManagerEntry newEntry;

		newEntry = RenameEntry(entry);

		return Json(newEntry);
	}

	public FileManagerEntry RenameEntry(FileManagerEntry entry)
	{
		var path = entry.Path;
		var physicalTarget = EnsureUniqueName(Path.GetDirectoryName(path), entry);
		FileManagerEntry newEntry;

		var file = new FileInfo(path);
		System.IO.File.Move(file.FullName, physicalTarget);
		newEntry = directoryBrowser.GetFile(physicalTarget);

		return newEntry;
	}

	public string EnsureUniqueName(string target, FileManagerEntry entry)
	{
		//Remove any extra file extensions that the user may have typed
		while (entry.Name.EndsWith(entry.Extension))
		{
			entry.Name = entry.Name.Remove(entry.Name.Length - entry.Extension.Length);
		}

		var fileName = entry.Name + entry.Extension;

		int sequence = 0;
		var physicalTarget = Path.Combine(target, fileName);

		//If the file name already exists, tack on a sequence #
		while (System.IO.File.Exists(physicalTarget))
		{
			fileName = entry.Name + String.Format("({0})", ++sequence) + entry.Extension;
			physicalTarget = Path.Combine(target, fileName);
		}

		return physicalTarget;
	}

	[HttpGet]
	public FileResult Download(string path)
	{
		FileInfo file = new FileInfo(path);

		System.Net.Mime.ContentDisposition cd = new System.Net.Mime.ContentDisposition
		{
			FileName = file.Name,
			Inline = false
		};
		Response.Headers.Add("Content-Disposition", cd.ToString());
		Response.Headers.Add("X-Content-Type-Options", "nosniff");

		string contentType = MimeMapping.GetMimeMapping(file.Name);
		var readStream = System.IO.File.ReadAllBytes(path);
		return File(readStream, contentType);

	}

	public ActionResult Destroy(FileManagerEntry entry)
	{
		var path = entry.Path;

		if (!string.IsNullOrEmpty(path))
		{
			DeleteFile(path);

			return Json(new object[0]);
		}
		throw new HttpException(404, "File Not Found");
	}

	public void DeleteFile(string path)
	{
		if (System.IO.File.Exists(path))
		{
			System.IO.File.Delete(path);
		}
	}

	/// <summary>
	/// Uploads a file to a given path.
	/// </summary>
	/// <param name="path">The path to which the file should be uploaded.</param>
	/// <param name="file">The file which should be uploaded.</param>
	/// <returns>A <see cref="JsonResult"/> containing the uploaded file's size and name.</returns>
	/// <exception cref="HttpException">Forbidden</exception>
	[AcceptVerbs(HttpVerbs.Post)]
	public virtual ActionResult Upload(string path, HttpPostedFileBase file)
	{
		var fileName = Path.GetFileName(file.FileName);

		if (true)
		{
			file.SaveAs(Path.Combine(path, fileName));

			return Json(new
			{
				size = file.ContentLength,
				name = fileName,
				type = "f"
			}, "text/plain");
		}

		throw new HttpException(403, "Forbidden");
	}
	
}

Anna
Top achievements
Rank 1
Iron
Iron
Iron
 asked on 12 Apr 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?