Telerik Forums
Kendo UI for jQuery Forum
7 answers
1.1K+ views
I need to call web api with basic authentication  inside trasport section of datasource, is it possible and how?
In detail, my api controller could retrieve from a third source just a page of datas so i need to use server pagination for grid values and pass the page i need, the only way to link to pagination mechanism is just to call directly the json web api, but i need to add basic+credentials to header. I'm working with angular and for http$ i iniect credential in header automatically, but i don't think it could work with transport in datasource. Any help? thanks in advance.
Daniel
Telerik team
 answered on 05 Sep 2014
2 answers
129 views
Like the title says. :)
The problem is that when getting selected value only first value is returned not array of all values.
Steps to reproduce: Add 2 items to both (normal and inherited) multiselect and carefully watch console. Multiselect returns array, but inherited multiselect returns only object of the first selected item.

dojo example
Matjaz
Top achievements
Rank 1
 answered on 05 Sep 2014
2 answers
226 views
Here's my template (from my .cshtml file):

<script id="row-checkbox-template" type="text/x-kendo-tmpl">
    <div style="text-align:center;">
    <input type="checkbox" class="chkRow" data-id="#=TransactionId#" #if (!IsEditable) {# disabled="disabled" #} else {# tabindex="0" #}# title="@AssignCategories.SelectRow" />
    </div>
</script>

In en-US locale, all works great, now I'm testing fr-CA and I'm getting "Uncaught Error: Invalid template."  I remove the localized text from the title attribute in the template and it works great.  BTW, the fr-CA value for the title that is causing the issue is: "Sélectionner une ligne".

How do I properly encode this value in the template?

Thanks,
--Ed
Ed
Top achievements
Rank 1
 answered on 05 Sep 2014
3 answers
115 views
Is there a way to re-position the red tick mark that denotes a changed cell. We would like the tick mark to be in the left top corner of the changed cell, even when the text is center aligned?  

See attached image.

Thanks,

Bradley 
Bradley
Top achievements
Rank 1
 answered on 04 Sep 2014
2 answers
370 views
Hi

i'm stuck during implementation own gantt view inside a WebBrowser Control for standard WinForms UI. I 've already added necessary Registry keys (Dword value) according to the guidelines through the provided class:

internal class WebToolKit : IProgramInitializer
    {
        private static UIntPtr HKEY_LOCAL_MACHINE = (UIntPtr)0x80000002;
        private static int KEY_READ = 0x20019;
        private static int KEY_WOW64_32KEY = 0x200;
        private static int KEY_WOW64_64KEY = 0x100;
        private static UInt32 IE_VERSION = 0x00002EDF;    /// DWORD value must be here
        /// it provides information about IE engine version
        /// for webbbrowser control container
       
        private static string registryKeyPath = "SOFTWARE\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION";
        private static string valueNameX86 = "OwnApp32.exe";
        private static string valueNameX64 = "OwnApp.exe";

        [DllImport("advapi32.dll", EntryPoint = "RegOpenKeyExW", CharSet = CharSet.Unicode, SetLastError = true)]
        private static extern int RegOpenKeyEx
            (UIntPtr hKey, string lpSubKey, uint ulOptions, int samDesired, out UIntPtr phkResult);
        [DllImport("advapi32.dll", EntryPoint = "RegQueryValueExW", CharSet = CharSet.Unicode, SetLastError = true)]
        private static extern int RegQueryValueEx(UIntPtr hKey, string lpValueName, IntPtr lpReserved, out uint lpType, StringBuilder lpData, ref uint lpcbData);
        [DllImport("advapi32.dll", SetLastError = true)]
        private static extern int RegCloseKey(UIntPtr hKey);
        public void Initialize()
        {
            UIntPtr zero = UIntPtr.Zero;
            string str = null;
            uint lpcbData = 0x1000;
            StringBuilder lpData = new StringBuilder((int)lpcbData);

            try
            {
                uint num2;
                if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, registryKeyPath, 0, KEY_READ | KEY_WOW64_64KEY, out zero) == 0)
                {
                    if (RegQueryValueEx(zero, valueNameX86, IntPtr.Zero, out num2, lpData, ref lpcbData) == 0)
                        str = lpData.ToString();
                    if (RegQueryValueEx(zero, valueNameX64, IntPtr.Zero, out num2, lpData, ref lpcbData) == 0)
                        str = lpData.ToString();
                }
                if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, registryKeyPath, 0, KEY_READ | KEY_WOW64_32KEY, out zero) == 0
                    && RegQueryValueEx(zero, valueNameX86, IntPtr.Zero, out num2, lpData, ref lpcbData) == 0)
                    str = lpData.ToString();
                if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, registryKeyPath, 0, KEY_READ | KEY_WOW64_32KEY, out zero) == 0
                    && RegQueryValueEx(zero, valueNameX64, IntPtr.Zero, out num2, lpData, ref lpcbData) == 0)
                    str = lpData.ToString();
            }
            finally
            {
                if (zero != UIntPtr.Zero)
                    RegCloseKey(zero);
            }
            if (String.IsNullOrEmpty(str))
            {
                try
                {
                    RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(registryKeyPath, true);
                    registryKey.SetValue(valueNameX86, IE_VERSION, RegistryValueKind.DWord);
                    registryKey.SetValue(valueNameX64, IE_VERSION, RegistryValueKind.DWord);
                }
                catch (SecurityException)
                {
                    System.Windows.Forms.MessageBox.Show(string.Format(
                           "Run this application under control of Administrator rights permissions"                            
                ));
                }

            }
        }

And until this place it works fine. I also have been checked browser version using JavaScript (navigator.AppName) and result was correct. But i have a trouble with user interaction between WebBrowser control and invoked UI navigation elements (i.e JQuery and Web Service are ok). For instance, splitter not working at all, just like progress trackBar on a Gantt.Timeline. Below i attached most important pieces of my code embedded webborwser control:  


// 
            // webBrowser1
            // 
            this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.webBrowser1.IsWebBrowserContextMenuEnabled = true;
            webBrowser1.IsAccessible = true;            
            this.webBrowser1.Location = new System.Drawing.Point(0, 0);
            this.webBrowser1.AllowWebBrowserDrop = true;
            this.webBrowser1.AllowNavigation = true;
            this.webBrowser1.Margin = new System.Windows.Forms.Padding(18, 39, 18, 39);
            this.webBrowser1.MinimumSize = new System.Drawing.Size(120, 260);
            this.webBrowser1.Name = "webBrowser1";
            this.webBrowser1.Size = new System.Drawing.Size(1028, 727);
            this.webBrowser1.ScriptErrorsSuppressed = true;
            this.webBrowser1.TabIndex = 1;
            this.webBrowser1.WebBrowserShortcutsEnabled = true;
            this.webBrowser1.ObjectForScripting = this;


internal void InitContext(Context cx)
        {
      
            this.webBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser1_DocumentCompleted); 
                this.webBrowser1.Navigate(String.Format("{0}/Home/Index", URL));
        }

        void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            //Poprawka dla property ScriptErrorsSuppressed
            //Normalnie blokuje otwarcie wszelkich pop-up nie tylko tych które sÄ… błędami skryptów JS
            //http://stackoverflow.com/questions/2476360/disable-javascript-error-in-webbrowser-control
            ((WebBrowser)sender).Document.Window.Error +=
                                 new HtmlElementErrorEventHandler(Window_Error);
            TrySetSuppressScriptErrors(webBrowser1, true);           
        }

        private static void Window_Error(object sender,
    HtmlElementErrorEventArgs e)
        {
            // Ignore the error and suppress the error dialog box. 
            e.Handled = true;

        }

        private void trackBarZoomBar_ValueChanged(object sender, EventArgs e)
        {
            ((SHDocVw.WebBrowser)webBrowser1.ActiveXInstance).ExecWB(SHDocVw.OLECMDID.OLECMDID_OPTICAL_ZOOM,
    SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER, trackBarZoomBar.Value, IntPtr.Zero);
            this.lbZoomLabel.Text = String.Format("{0} %", trackBarZoomBar.Value);
        }

        private static bool TrySetSuppressScriptErrors(WebBrowser webBrowser, bool value)
        {
            FieldInfo field = typeof(WebBrowser).GetField("_axIWebBrowser2", BindingFlags.Instance | BindingFlags.NonPublic);
            if (field != null)
            {
                object axIWebBrowser2 = field.GetValue(webBrowser);
                if (axIWebBrowser2 != null)
                {
                    axIWebBrowser2.GetType().InvokeMember("Silent", BindingFlags.SetProperty, null, axIWebBrowser2, new object[] { value });
                    return true;
                }
            }

            return false;
        }


I have no idea what am i doing wrong. I'll be gratefull for any sugestions.

Best regards
Luke







Piotr
Top achievements
Rank 1
 answered on 04 Sep 2014
1 answer
301 views
Hi,

I am trying to get all controls on the page using $(document).getElementsByTagName("*") and set attributes like ReadOnly and Visibility based on defined permissions for each control.

In the result of $(document).getElementsByTagName("*") I noticed that I get three elements for one KendoUI ComboBox...

Element 1
<span class="k-widget k-combobox k-header FundFeeChangedDataIvan"><span class="k-dropdown-wrap k-state-default" tabIndex="-1" unselectable="on"><input aria-disabled="false" style="width: 100%;" aria-expanded="false" aria-readonly="false" class="k-input FundFeeChangedDataIvan" role="combobox" tabIndex="0" aria-owns="ddlTiming_listbox" name="ddlTiming_input" type="text" autocomplete="off" aria-autocomplete="list"><span class="k-select" tabIndex="-1" unselectable="on"><span class="k-icon k-i-arrow-s" role="button" tabIndex="-1" aria-controls="ddlTiming_listbox" unselectable="on">select</span></span></span><input aria-disabled="false" style="display: none;" id="ddlTiming" aria-readonly="false" class="FundFeeChangedDataIvan" name="ddlTiming" type="text" data-role="combobox"></span>

Element 2
<input aria-disabled="false" style="width: 100%;" aria-expanded="false" aria-readonly="false" class="k-input FundFeeChangedDataIvan" role="combobox" tabIndex="0" aria-owns="ddlTiming_listbox" name="ddlTiming_input" type="text" autocomplete="off" aria-autocomplete="list">

Element 3
<input aria-disabled="false" style="display: none;" id="ddlTiming" aria-readonly="false" class="FundFeeChangedDataIvan" name="ddlTiming" type="text" data-role="combobox">

How can I determine the set of elements that belong to one KendoUI ComboBox and also parse them into a KendoUI ComboBox in .js file to set attibutes such as ReadOnly and Visibility.

Note: I have also used $(document)[0].getElementsByClassName('FundFeeChangedDataIvan') and the result is still same.

Thanks
Dimo
Telerik team
 answered on 04 Sep 2014
1 answer
330 views
Hi.

For KendoUI controls on a page, how can i implement security features (like readOnly, Visibility etc.) at control level. Can you please suggest any method that I can use to implement this.

Thanks
Dimo
Telerik team
 answered on 04 Sep 2014
2 answers
514 views
I understand that if you have a recurrence series, you can edit a single occurrence and show only that exception.
The important piece of data to bind these together is the RecurrenceId. The original series also contains the RecurrenceException date.

I went through the online demo and using Dev Tools, I could see the data that is passed between the server and client.
Like this:

Exception:
{"TaskID":122,"OwnerID":1,"Title":"No title 
(Inherited)","Description":"Inherited","StartTimezone":"","Start":"\/Date
(1371022200000)\/","End":"\/Date
(1371031200000)\/","EndTimezone":"","RecurrenceRule":null,"RecurrenceID":121,"RecurrenceExceptio
n":null,"IsAllDay":false},

Original Recurrence:
{"TaskID":121,"OwnerID":1,"Title":"No 
title","Description":"","StartTimezone":"","Start":"\/Date(1371020400000)\/","End":"\/Date
(1371034800000)\/","EndTimezone":"","RecurrenceRule":"FREQ=WEEKLY;BYDAY=WE,TH,FR","RecurrenceID"
:null,"RecurrenceException":"20130612T070000Z;","IsAllDay":false}

This displays correctly.

When I try to do the same with my own data, I show two separate events in the scheduler. My data looks like this:

{"Id":11,"Start":"2014-09-01T08:30:00.000","End":"2014-09-01T16:00:00.000","Title":"Open 
Hours","ScheduleType":5,"RecurrenceId":null,"RecurrenceRule":"FREQ=WEEKLY;BYDAY=SU,WE,FR,SA","Re
currenceException":"20140905T070000Z","LocationId":103157,"Description":null,"IsAllDay":false},

{"Id":12,"Start":"2014-09-05T09:30:00.000","End":"2014-09-05T16:00:00.000","Title":"Open 
Hours","ScheduleType":5,"RecurrenceId":11,"RecurrenceRule":null,"RecurrenceException":null,"Loca
tionId":103157,"Description":null,"IsAllDay":false}

Not sure why this shows as two events. I've tried various formats for my RecurrenceException data (I'm saving start and end as datetime).
Am I missing something particular here?

Please advice,

Thank you






Bruce
Top achievements
Rank 1
 answered on 04 Sep 2014
4 answers
583 views

I have a Kendo UI grid. The grid has a datasource with complex object data. For example, {"foo": {"bar" : 10}}. Although the column field can navigate the object graph (i.e. foo.bar), the aggregate field doesn't seem to be able to.

Here's the code:

var grid = $("#grid").kendoGrid({
   dataSource: {
       data: [
           {"foo": {"bar": 10}},
           {"foo": {"bar": 20}}
       ],

       aggregate: [
           {field: "foo.bar", aggregate: "sum"}
       ]  
   },
   columns: [
       {
           field: "foo.bar",
           footerTemplate: "Sum: #= sum # "
      }
  ]   
}).data("kendoGrid");

Here's the fiddle: http://jsfiddle.net/e6shF/1/

Firebug reports "TypeError: data.foo is undefined" in line 8 of kendo.all.min.js.

Am I doing something incorrectly? If this is a bug in Kendo, is there a way to work around this? I have to keep the objects complex.

Alexander Popov
Telerik team
 answered on 04 Sep 2014
9 answers
1.1K+ views
I've got a custom dropdown multi-select widget in one of my grid column headers, "Status". Each of the three statuses that can be chosen represent a group of statuses to show together when one of the dropdown values is selected. I need to be sure not to wipe out any current statuses that might be applied to my grid from the other columns. 

For example, I retrieve the current filters like so:

var grid = $('#accountsGrid');
var currentFilters = grid.data('kendoGrid').dataSource.filter();

Which gives me this object:
{"filters":[{"field":"name","operator":"contains","value":"JOHNSON"},{"field":"city","operator":"contains","value":"MILWAUKEE"},{"field":"state","operator":"eq","value":"WI"}],"logic":"and"}

I then build my status filter, resulting in this object:
{"logic":"or","filters":[{"field":"status","operator":"eq","value":"A"},{"field":"status","operator":"eq","value":"G"},{"field":"status","operator":"eq","value":"O"},{"field":"status","operator":"eq","value":"P"},{"field":"status","operator":"eq","value":"S"}]}

I then combine them together and apply to the datasource:

var newFilters = { logic: "and", filters: [] };
newFilters.filters.push(currentFilters);
newFilters.filters.push(statusFilters);
grid.data('kendoGrid').dataSource.filter(newFilters);

newFilters object:
{"logic":"and","filters":[{"filters":[{"field":"name","operator":"contains","value":"JOHNSON"},{"field":"city","operator":"contains","value":"MILWAUKEE"}],"logic":"and"},{"logic":"or","filters":[{"field":"status","operator":"eq","value":"A"},{"field":"status","operator":"eq","value":"G"},{"field":"status","operator":"eq","value":"O"},{"field":"status","operator":"eq","value":"P"},{"field":"status","operator":"eq","value":"S"}]}]

Here's my issue: when status gets changed again, I need to get the current filters (which will be the above value), but I need to parse out any existing status filters, so I can rebuild with the new criteria, without losing any other filter information. I think it's the nested result from combining filters that's making it so difficult, but I also think someone with experience transversing these kind of objects would probably be able to do it in their sleep!





Carey
Top achievements
Rank 1
 answered on 04 Sep 2014
Narrow your results
Selected tags
Tags
Grid
General Discussions
Charts
Data Source
Scheduler
DropDownList
TreeView
MVVM
Editor
Window
DatePicker
Spreadsheet
Upload
ListView (Mobile)
ComboBox
TabStrip
MultiSelect
AutoComplete
ListView
Menu
Templates
Gantt
Validation
TreeList
Diagram
NumericTextBox
Splitter
PanelBar
Application
Drag and Drop
Map
ToolTip
Calendar
PivotGrid
ScrollView (Mobile)
Toolbar
TabStrip (Mobile)
Slider
Button (Mobile)
Filter
SPA
Drawing API
Drawer (Mobile)
Globalization
LinearGauge
Sortable
ModalView
Hierarchical Data Source
Button
FileManager
MaskedTextBox
View
Form
NavBar
Notification
Switch (Mobile)
SplitView
ListBox
DropDownTree
PDFViewer
Sparkline
ActionSheet
TileLayout
PopOver (Mobile)
TreeMap
ButtonGroup
ColorPicker
Pager
Styling
Chat
MultiColumnComboBox
Dialog
DateRangePicker
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Accessibility
Effects
PivotGridV2
Licensing
ScrollView
Switch
TextArea
BulletChart
QRCode
ResponsivePanel
Wizard
CheckBoxGroup
Localization
Barcode
Breadcrumb
Collapsible
MultiViewCalendar
Touch
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
TaskBoard
Popover
DockManager
TimePicker
FloatingActionButton
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
BottomNavigation
Ripple
SkeletonContainer
Avatar
Circular ProgressBar
FlatColorPicker
SplitButton
Signature
Chip
ChipList
VS Code Extension
AIPrompt
PropertyGrid
Sankey
Chart Wizard
OTP Input
SpeechToTextButton
InlineAIPrompt
StockChart
ContextMenu
DateTimePicker
RadialGauge
ArcGauge
AICodingAssistant
SmartPasteButton
PromptBox
SegmentedControl
+? more
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?