Telerik Forums
Kendo UI for jQuery Forum
1 answer
200 views

I want to include an active x object on a grid edit popup and it has an associated change event specified in jscript so I need to include the script for that. 

$(gridID).kendoGrid({
        dataSource: dataSource,
        navigatable: true,
        pageable: true,
        editable: {
            mode: "popup",
            template: function(data){return getPopupTemplate(data) }
        },
etc....
 
function getPopupTemplate(data) {
    var s =
             '<object id="ChemistryQuery" codebase="MDL.Draw.Editor.dll#-1,-1,-1,-1" height="240" width="240" classid="CLSID:FCE57399-E34B-45ce-881B-5FDFF3583307" class="drawingbox" >' +
                '<param name="ShowHydrogens" value="False">' +
                '<param name="ChimeString" id="ChimeString" value="' + data.NEW_CHEMISTRY + '">' +
             '</object>' +
             '<input type="hidden" name="NEW_CHEMISTRY" class="form-control" id="NEW_CHEMISTRY" />' +
             '<input type="text" name="TEXT_DESCRIPTOR" class="form-control" id="TEXT_DESCRIPTOR" />' +
             '<script language="jscript">' +
                'function ChemistryQuery::ComStructureChanged(){ ' +
                    'if (ChemistryQuery.ChimeString) {' +
                        'NEW_CHEMISTRY.value = ChemistryQuery.ChimeString;' +
                    '}' +
                '}' +
             '</script>';
    return s;
}

 

However, this results in an error  stating the ChemistryQuery object can't be found.

I have done something similar to this on a dialog using Kendo UI for JSP and that works fine.

<kendo:dialog name="dialog" title="Enter Reaction Schema" closable="false" modal="true" close="onDrawerClose" visible="false" initOpen="initDialogFields"
        content='<div class="form-group">
                     <label for="description" class="col-md-3 control-label k-label">Description</label>
                     <input type="text" name="description" class="reactionSchemaWidth k-input" id="description" />
                     <span class="required">*</span>
                </div>
                <div class="form-group">
                     <object id="ChemistryQuery" codebase="MDL.Draw.Editor.dll#-1,-1,-1,-1" height="240" width="240" classid="CLSID:FCE57399-E34B-45ce-881B-5FDFF3583307" class="drawingbox">
                        <param name="ShowHydrogens" value="False">
                        <param name="ChimeString" id="ChimeString">
                     </object>
                </div>
                <div class="form-group">
                    <div class="error formerror" id="dialogError"><span> </span></div>
                </div>
                <div class="form-group">
                    <input type="hidden" name="molstructure" id="molstructure" />
                </div>
                <script language="jscript">
                    function ChemistryQuery::ComStructureChanged(){
                        if (ChemistryQuery.ChimeString) {
                            molstructure.value = ChemistryQuery.ChimeString;
                        }
                    }
                </script>'>
        <kendo:dialog-actions>
            <kendo:dialog-action text="Done" primary="true" action="validateDrawForm" />
            <kendo:dialog-action text="Cancel" />
        </kendo:dialog-actions>
    </kendo:dialog>

 

So there must be a difference in the rendering timing of the two approaches.  I've tried using the kendo.template but I couldn't get the syntax right because of the <script? tags.  I've also tried changing the content in a edit handler for the grid but this loses the bindings on the other input fields.

I realise you can't work with this because you don't have my active-x control but could you please suggest a way to insert this jscript at the appropriate time?

Jane
Top achievements
Rank 1
 answered on 26 May 2017
1 answer
120 views

Hello,

when using the mobile version of the mentioned views there seems to be some calculation error when trying to select time slots. The calendar is configured with create disabled but selection enabled, so that the user can touch a time slot to select it. When the area to the left of the time slots (groupings, allday-label, etc) has certain widths, some days of the week becomes unselectable. Instead, the day before gets selected.

I have dug into the problem and seen that in these cases, the right edge of the time slot before is one pixel greater than the left edge of the time slot touched. Furthermore, the touch event gets rounded to the leftmost value of the touched time slot. This makes the select criteria to evaluate as true for both slots, and the "first" of them will be selected.

The problem is experienced on an iPad in portrait orientation, but it is possible that other resolutions is affected as well. 

Here is a more descriptive example of what happens, the slots is represented with || and the numbers are the coordinates of the egdes:

|| 100                                 210||209                             300||300                                       410||

When selecting the second time slot, the touch is rounded to 209, which will is considered inside the span of 100 <= 209 < 210, and the first slot is selected.

Some floating point error at play here perhaps?

Sorry for the long post, hope that it was helpful though.

Best regards.

Dimitar
Telerik team
 answered on 26 May 2017
1 answer
1.2K+ views

Thought I'd post this for anyone who has a similar issue. And also for kendo staff to see and fix (if it is indeed a bug).

Note: all references to input are in regard to type=checkbox and type=radio, not text input areas

I was adding input boxes to a mobile listview and found that if any tag is added outside of the label tag holding the input, the input doesn't work. It also appears that an input without a label container doesn't seem to function properly either. Whereas a input defined inside a label inside a mobile listview will have extra classes and an ::after appended to it, none of these show up in the case noted in the first sentence of this paragraph. I finally got it to work with a workaround after observing "correctly working" inputs and what kendo injects into the html for those items.

IT policy at my work prevents me from creating a code snippet, so I pasted the code below, which is a modified version of http://demos.telerik.com/kendo-ui/m/index#popover/index:

<!DOCTYPE html>
<html>
<head>
    <style>html { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }</style>
    <title></title>
 
</head>
<body>
<div data-role="view" data-title="Tag this photo" id="popover" data-use-native-scrolling="true">
    <div data-role="header">
        <div data-role="navbar">
            <a id="back-button" class="nav-button" data-align="left" data-role="backbutton">Back</a>
            <span data-role="view-title"></span>
            <a data-align="right" data-rel="popover" href="#popover-people" data-role="button" data-icon="contacts"></a>
            <a data-align="right" data-icon="source-code" data-click="goToSourceCode" data-role="button" title="Show this demo source code"></a>
        </div>
    </div>
 
    <div data-role="content" style="text-align: center;">
        <img src="../content/mobile/shared/faces.jpg" />
    </div>
 
    <div data-role="popover" id="popover-people" data-popup='{"height": "20em", "width": "20em"}'>
        <div data-role="view" data-title="People">
            <div data-role="header">
                <div data-role="navbar" class="km-light">
                    <span data-role="view-title"></span>
                    <a data-role="button" data-align="right" data-click="closeParentPopover" data-icon="close"></a>
                </div>
            </div>
            <ul data-role="listview" data-click="clickit">
              <li><label>Isabella Anderson<input type="checkbox" checked="checked" class="km-widget km-icon km-check"></label><span>Test</span></li>
                <li><input type="checkbox" checked="checked"></li>
                <li><label>Linda Anderson<input type="checkbox"></label></li>
                <li><label>Oliver Anderson<input type="checkbox"></label><a></a></li>
                <li><div></div><label>James Williams<input type="checkbox"></label></li>
                <li><label>Barbara Williams<input type="checkbox"></label></li>
            </ul>
        </div>
    </div>
 
    <div data-role="popover" id="popover-location" data-popup='{"width": "20em"}'>
        <div data-role="view">
            <ul data-role="listview" data-click="clickit">
                <li><label>Sydney, Australia <input name="location" type="radio"></label></li>
                <li>New York, USA <input name="location" type="radio"></li>
                <li><input name="location" type="radio"><div>Test</div></li>
            </ul>
        </div>
    </div>
 
    <div data-role="footer">
        <div data-role="navbar">
            <a data-align="right" href="#popover-location" data-rel="popover" data-role="button">Location</a>
        </div>
    </div>
</div>
<script>
    function clickit(e) {
      console.log(e.item.find('input').prop('checked'));
    }
</script>
 
<script>
    var app = new kendo.mobile.Application(document.body, { skin: "nova" });
</script>
</body>
</html>

Note the modified lines in the listviews where I remove labels in a few of them and in others I add random html tags before and after the </label>. It didn't matter if they were empty or had content in them.

I also tried modifying the 'checked="checked"' values via jQuery and also through data-binding with a ternary operator like one of your admins showed in this forum thread: http://www.telerik.com/forums/dynamically-creating-checkbox-listview-doesn-t-allow-selecting. While the value shows to be checked, and a $(elem).prop('checked') will return true/false correctly, the box doesn't show the checkbox when 'checked="checked"' is present in the input element (see the 'clickit' function and 2nd item of listview with checkboxes in the code snippet).

The thing that finally worked was to use jQuery to set the $(elem).prop('checked', true/false) ANDmanually add the classes I note were added automatically to inputs that 'work properly' : km-widget km-icon km-check. Note the very first listview item with checkboxes in the code snippet.

Now the question for staff: Why doesn't kendo automatically add these classes to listview inputs except in cases where it's <label>TEXT<input type="radio/checkbox" /></label> ? Is this a bug? Or if it's intended, why? In more complicated templates, such as the one in my code, it requires workarounds with setting the listview's data-click AND adding those three above classes to all my inputs if they're not exactly in a format that "works" (it also seems all kendo examples of inputs in listviews follow that exact formatting, which leads me to assume this issue is known...just uncommonly crossed upon by users). It's not a big deal once I figured it out, but the time spent wondering what was wrong and stepping through my code and all the possibilities was time consuming.

Or am I just doing things in the most horribly wrong way?

P.S. Out of curiosity, why was there a need to override/prevent the default behavior of the checkbox and radio inputs? Just for aesthetic purposes?

Stefan
Telerik team
 answered on 26 May 2017
1 answer
165 views

H,

Current the Window widget has Maximize and Minimize events, but not a Restore event.

Can you please consider adding a Restore event?

I have added the functionality in the Window widget source code, but I this is not a good long-term solution.

 

Thanks

 

Ivan Danchev
Telerik team
 answered on 26 May 2017
3 answers
511 views

I have a templated list:

<script type="text/x-kendo-tmpl" id="xts-contents-detail-template">
   <div id='contents-list-sortable' data-role="listview sortable" data-template="xts-content-item-template" data-selectable="single"
        data-bind="source: contentDataSource">
   </div>
</script>

<script type="text/x-kendo-tmpl" id="xts-content-item-template">
   <div>
      <hr>
      <h5> <span data-bind='text: name'> </span> </h5>
      <span data-bind='text: description'> </span>
   </div>
</script>

Which later gets populated in Javascript:

            this.pObservableContent = kendo.observable({
                contentDataSource: new kendo.data.DataSource({
                    data: [],
                }),
            });

            let listView = new kendo.View('#xts-contents-detail-template', {
                model: this.pObservableContent,
            });

            // put the list somewhere
            let listHtml = listView.render();
            this.pView.element.find('.contents-list').html(listHtml);

            // make the list sortable
            // this.pView.element.find('#contents-list-sortable').kendoSortable({
            $('#contents-list-sortable').kendoSortable({
            });

Also, some content gets added later on:

           this.pObservableContent.contentDataSource.data(this.pReportDefinition.contents);

The user may then re-order the list.

this.pObservableContent.contentDataSource.data() does not reflect the user selected order. How do I know what the new order is?

Gerry
Top achievements
Rank 1
Veteran
 answered on 25 May 2017
1 answer
174 views

Good afternoon,

Is there a sample on how to validate a field as required/mandatory in a Kendo Grid that allows inline editting and that is bound to a source using MVVM?

I know I can define that in the schema but I don't see how to define the schema with the data-* attributes in this case... should I do it with Javascript manually?

A sample would be nice ..so please if you know of any please share it here.

Thanks!

 

Boyan Dimitrov
Telerik team
 answered on 25 May 2017
2 answers
280 views

Hi guys,

i'm Liuk and i like a lot Kendo's Grid.

But i've a problem with the Hierarchy system, because i can't find a method for open the subgrid only if there is a flag true.

I give an example:

This is th example take from the kendo text

<code>

<!DOCTYPE html><html><head><title></title><link rel="stylesheet" href="styles/kendo.common.min.css" /><link rel="stylesheet" href="styles/kendo.default.min.css" /><link rel="stylesheet" href="styles/kendo.default.mobile.min.css" /><script src="js/jquery.min.js"></script><script src="js/kendo.all.min.js"></script></head><body><div id="example"><div id="grid"></div><script> $(document).ready(function() {var element = $("#grid").kendoGrid({ dataSource: { type: "odata", transport: { read: "https://demos.telerik.com/kendo-ui/service/Northwind.svc/Employees"}, pageSize: 6, serverPaging: true, serverSorting: true}, height: 600, sortable: true, pageable: true, detailInit: detailInit, dataBound: function() {this.expandRow(this.tbody.find("tr.k-master-row").first());}, columns: [{ field: "FirstName", title: "First Name", width: "110px"},{ field: "LastName", title: "Last Name", width: "110px"},{ field: "Country", width: "110px"},{ field: "City", width: "110px"},{ field: "Title"}]});});function detailInit(e) { $("<div/>").appendTo(e.detailCell).kendoGrid({ dataSource: { type: "odata", transport: { read: "https://demos.telerik.com/kendo-ui/service/Northwind.svc/Orders"}, serverPaging: true, serverSorting: true, serverFiltering: true, pageSize: 10, filter: { field: "EmployeeID", operator: "eq", value: e.data.EmployeeID }}, scrollable: false, sortable: true, pageable: true, columns: [{ field: "OrderID", width: "110px" },{ field: "ShipCountry", title:"Ship Country", width: "110px" },{ field: "ShipAddress", title:"Ship Address" },{ field: "ShipName", title: "Ship Name", width: "300px" }]});}</script></div></body></html>

</code>

for my example i wanna see the sub grid only if the city is "Tacoma", but i can't find a solution online.

Ty for the help guys and i'm sorry for the bad English,

BB Liuk

Surapazzo
Top achievements
Rank 1
 answered on 25 May 2017
6 answers
290 views

Hello

I'm using kendoUI multiselect, but have some issues with the event click and destroy.

I'm using Kendo UI v2017.1.118, AngularJS v1.6.4 and jquery-2.2.1

Here is my source code using the MultiSelect:

F

<div ng-controller="icpSinglePersonSelectionController as c" >
    <select kendo-multi-select id="selectusers" name="selectusers" k-ng-model="c.uids" k-value-primitive="true"
                k-options="c.selectOptions"  k-on-change="c.onMultiSelectSelected(kendoEvent)" >
    </select>
</div>

 

 

app.controller("icpSinglePersonSelectionController",
    
    ['$http', '$scope', function
        ($http, $scope) {
        var me = this;
       
        me.uids = [];
        me.AllowMultipleSelections= false
           
           me.uid="111111"
           me.pname="test"
           me.uids = [];
           me.value_url ="ContentService/" & uid & "/" & pname          
           me.possible_value_url = "ContentService/getPossiblePersonValuesForEdit?uid=" &
                                 uid & "&pname=" & pname
          var  dataSource = new kendo.data.DataSource({
                transport: {
                    read: {
                        url: me.possible_value_url,
                    }
                },                          
                schema: {
                    data: function (data) {
                        return angular.fromJson(data);
                    }
                }
            });
            $http.get(me.value_url).then(function (renspose) {

                    var jsondata = angular.fromJson(renspose);
                    var itemData = jsondata[me.pname];
                        if (angular.isArray(itemData)) {
                            me.uids = itemData.map(function (item) { return item.uid; });
                        }
                        else {
                            me.uids = [itemData.uid];
                        }
                                 
                    me.selectOptions = {
                        dataTextField: "reference_text",
                        dataValueField: "Id",
                        footerTemplate: 'Total #: instance.dataSource.total() # items found',
                        itemTemplate: '<table><tr><td><img class="k-state-default" src="#:data.icon#" height=50px></img></td>' +
                                      '<td><span class="k-state-default"><h3>#: data.reference_text #</h3><p>#: data.department #</p></span></td></tr></table>',
                        tagTemplate: '<img class="k-state-default" src="#:data.icon#" height=20px></img><span>#:data.reference_text#</span>',
                        virtual: {
                            mapValueTo: "dataItem",
                            valueMapper: function (options) {
                                $http.post("UserService/getPersons",
                                    { uids: me.uids }
                                ).then(function (response) {
                                    options.success(response); //return the dataItems that correspond to provided values
                                });
                            },
                            itemHeight: 80
                        },
                        dataSource: dataSource,
                        pageSize: 80,
                        serverPaging: false,
                        serverFiltering: true,
                        height: 520,
                        value: me.uids,
                        autoClose: true,
                        maxSelectedItems: 1,
                        filter: "contains",
                    };

            });
            me.onMultiSelectSelected = function (e) {
                var multiselect = e.sender,
                   amountOfSelectedItems = multiselect.dataItems().length,
                   maxSelectedItems = multiselect.options.maxSelectedItems;

                if (amountOfSelectedItems >= maxSelectedItems) {
                    $('.k-input').attr('readonly', "readonly");
                }
                else {
                    $('.k-input').removeAttr('readonly');
                }

            }; 
       
        
}]);

 

Note: When I delete virtualization the events return to work and if I use virtualization without grouping it works.
Dimitar
Telerik team
 answered on 25 May 2017
3 answers
441 views

I have a grid with multi-column headers and there is a group column A which is locked. Here is the code:

$scope.gridOptions.columns = [
                {
                    title: "A", locked: true, headerAttributes: { "class": "section-border" }, groupId : "A",
                    columns: [{ field: "ROW_HEADER", filterable: false, width: "20px", title: "   .", sortable: false, locked: true, headerAttributes: { "class": "sub-col darkYellow-col rowHeaderHeadYellow", "style": "border-right: 0px !important;" }, attributes: { "class": "contert-alpha  rowHeaderCell" } },
                              { field: "COLUMN1", title: "COLUMN1", width: "80px", hidden: true, locked: true, headerAttributes: { "class": "sub-col darkYellow-col rowHeaderHead2" }, attributes: { "class": "" }, template: "#: COLUMN1)#" },
                              { field: "COLUMN2", title: "COLUMN2", width: "150px", locked: true, headerAttributes: { "class": "sub-col darkYellow-col rowHeaderHead2" }, attributes: { "class": "" }, template: #:COLUMN2#}
                              ]
                },
                {
                    title: "B", headerAttributes: { "class": "section-border" }, groupId: "B",
                    columns: [{ field: "COLUMN3", title: "COLUMN3", width: "110px", headerAttributes: { "class": "sub-col continuity" }, attributes: { "class": "contert-alpha center-middle" }, template: "#: COLUMN3 #" },
                              { field: "COLUMN4", title: "COLUMN4", width: "120px", headerAttributes: { "class": "sub-col no-left-border" }, attributes: { "class": "contert-number " }, format: "{0: MM/dd/yyyy}" },
                               }]
                }]

 I want to unlock the group column A programmatically before printing the grid so that it appears as one grid instead of two. I have set locked=false for COLUMN1, COLUMN2 and group column A before printing but it still stays locked. Then I've set only group column A as unlocked before printing and the group still stays locked. I am using recursive method to unlock them but I but in order to show the gist of this functionality I am doing this to unlock:

thisGrid.unlockColumn("A");
thisGrid.unlockColumn("ROW_HEADER");
thisGrid.unlockColumn("COLUMN1");
thisGrid.unlockColumn("COLUMN2");
Where thisGrid is instance of above grid. If anyone has programmatically locked/unlocked multi-column header please help. Thanks
Preslav
Telerik team
 answered on 25 May 2017
8 answers
653 views
Hi!

I want to clear, for example, the filter array in my grid:
$('table#user_org_table').data('kendoGrid').dataSource.filter({});

Filter is cleared, but after this .filter() function, my grid is automatically refreshed.
How to clear filter, sorting and paging with 1 time grid refreshing?

Thanks.
Konstantin Dikov
Telerik team
 answered on 25 May 2017
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
Map
Drag and Drop
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
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?