Telerik Forums
Kendo UI for jQuery Forum
1 answer
202 views
I'm a scenario, where I should load the multiple methods to get the response for the grid. From the below code, I suppose to load the loadData() function in the read function. Code is showing below.

 

The loadData function is having nested function. Once the first method is completed I have to call the second method on promise of first method. Once all the method executed.  I've to call the parse function. ​ 

 

If I use single restApi It's working fine. But here I have ​methods method on promise... ​So how to handle this kind of scenario. 

 

dataSource: new kendo.data.DataSource({
     transport: {
        read: loadData
     },
     schema: {
        parse: $scope.kendoParse
         ......
         .......

 

 

function loadData(){
    atFacade.eventDataApi.getCurrentShift().then((data) => {
                $scope.fleetListingFilter.currentShift = data;
                getAllOperatingSummary();
            });
}
 
function getAllOperatingSummary() {
    var startDate = new Date().now() + " " + $scope.fleetListingFilter.currentShift.startTime;
    var endDate = new Date().now() + " " + $scope.fleetListingFilter.currentShift.endTime;
    var operatingSummary = new at.Models.OperatingSummaryReportFilter(events.PAYLOAD, [], startDate, endDate);
    $scope.fleetListingPromise = atFacade.eventDataApi.getOperatingSummaryReportData(operatingSummary).then((data) =>       {$scope.allVehicles = data;
                    loadAllVehicles();
                });
    }
 
     function loadAllVehicles() {
                $scope.fleetListingPromise = atFacade.eventDataApi.getAllVehicles().then((data: Array<any>) => {
                    for (var i = 0, total = data.length; i < total; i++) {
                        for (var j = 0, tot = $scope.allVehicles.length; j < tot; j++) {
                            if (data[i].id === $scope.allVehicles[j].vehicleId) {
                                data[i].summary = $scope.allVehicles[j];
                            }
                        }
                    }
                    $scope.vehicles = data;
                    $scope.kendoParse(data);
                });
            }
 
$scope.kendoParse = (result) => {
                var data = [];
                var results = atFacade.restangularService.stripRestangular(result);
                for (var i = 0; i < results.length; i++) {
                    var fleetListingData = {
                        name: results[i].name,
                        registrationNumber: results[i].registrationNumber,
                        operator: results[i].summary.operator,
                        lastStop: results[i].summary.lastStop
                    };
                    data.push(fleetListingData);
                }
                return { "results": data, "totalResults": data.length };
            };
Nikolay Rusev
Telerik team
 answered on 30 Sep 2015
1 answer
1.1K+ views

Hello,

Does Window component support nested modal window?

I tried to open two modal windows like the sample code

<script type="text/JavaScript">
function openWinOne() {
    var winOne = jQuery("\#win_one");
    if (!winOne.data("kendoWindow")) {
        winOne.kendoWindow({
            modal: true
        }).data("kendoWindow").center();
    }
    ......
}
function openWinTwo() {
    var winOne = jQuery("\#win_two");
    if (!winOne.data("kendoWindow")) {
        winOne.kendoWindow({
            modal: true
        }).data("kendoWindow").center();
    }
    ......
}
</script>
 
<div id="test">
    <button onClick="openWinOne();">
</div>
<div id="win_one" style="display: none;">
    <button onClick="openWinTwo();">
</div>
<div id="win_two" style="display: none;">
</div>

When closing the 2nd modal window, the focus is returned to 1st modal window but the background mask is also removed.

How can I keep the background mask when closing the nested modal windows?

Atanas Georgiev
Telerik team
 answered on 30 Sep 2015
6 answers
336 views
Hi,

how can I make a window that fills the whole screen except for a margin of say 50px (I want to make sure the user notices that this is a window and not a new page). It should keep these margins when resizing the browser window.

Thanks
Inception
Top achievements
Rank 1
Veteran
 answered on 30 Sep 2015
5 answers
416 views

Hello,

I have an issue with the 100% stacked bars chart. The vertical axis display duplicate values: 100%, 99%, 98% , 97%

Please see this dojo link to reproduce the issue.

 Can you please help me with this issue?

Thanks,
Alex

EZ
Top achievements
Rank 2
 answered on 30 Sep 2015
4 answers
388 views
In the following Dojo: http://dojo.telerik.com/agAfU/3
"Add" splitButton is disabled as expected.
"View->Profile" item of splitButton is not disabled (most probably a defect).
Alexander Valchev
Telerik team
 answered on 30 Sep 2015
1 answer
3.2K+ views

Hi there,

On my live code the excel export from the grid is not working because of this error in the Chrome console :-

Mixed Content: The page at 'https://(xxx)' was loaded over HTTPS, but requested an insecure script 'http://cdnjs.cloudflare.com/ajax/libs/jszip/2.4.0/jszip.js'. This request has been blocked; the content must be served over HTTPS.

How do I go about including this script safely on an HTTPS connection?

Thanks,

Mark

 

Rosen
Telerik team
 answered on 30 Sep 2015
1 answer
834 views

I have Views with multiple PanelBars and I want to be able to enable and disable all the PanelBars to simulate a ReadOnly View.

Is it possible to Disable a PanelBar but still allow the user to Collapse and Expend it?

Dimo
Telerik team
 answered on 30 Sep 2015
1 answer
91 views

I use kendo's source LESS files as part of my build. I updated to 902 but quickly realized theme-template.less is now missing. http://docs.telerik.com/kendo-ui/web/appearance-styling still references this file.

I briefly looked at the source but feel more comfortable asking what/how I should include the less files now.

kendo.flat.less has a single import - type-flat.less. type-flat.less imports common/mixins and themes/type.less but then it goes on to define styles that have nothing to do with type? border-color? background-color? I don't follow the rationale here.

Alex Gyoshev
Telerik team
 answered on 30 Sep 2015
3 answers
131 views
I was wondering if there is a way to set the view to either day or week based upon screen size within a scheduler view model? The scheduler I am trying to build will display the day view in mobile portrait and week view in mobile landscape. Your help is much appreciated! 
Vladimir Iliev
Telerik team
 answered on 30 Sep 2015
1 answer
521 views

I have 7 grids on a tabbed page using AngularJS. My setup worked fine as of verson 2015.1.429, but after trying an upgrade to 2015.2.x I experience some really odd behavior.

First, none of the grids show up, even though the read() method on the datasource runs. Secondly, one of the grids doesn't stop making requests after receiving a 204 from the server.

001.scope.expenseGridOptions = {
002.    dataSource: new kendo.data.DataSource({
003.        type: "odata",
004.        transport: {
005.            read: function (options) {
006.                scope.working = true;
007. 
008.                var odataParams = ODataFactory.mapParameters(options.data);
009. 
010.                // Override orderby property alias
011.                if (odataParams.$orderby) {
012.                    odataParams.$orderby = odataParams.$orderby.replace(/\/title/, '/Title');
013.                }
014. 
015.                ExpenseService.queryProjectExpenses($stateParams.id, odataParams).then(function (result) {
016.                    scope.working = false;
017. 
018.                    if (result && result.value) {
019.                        // Make sure all items have Invoice field
020.                        _.each(result.value, function(item) {
021.                            if (!item.Invoice) {
022.                                item.Invoice = {};
023.                            }
024.                        });
025. 
026.                        options.success(result);
027.                    } else {
028.                        options.success({});
029.                    }
030.                });
031.            }
032.        },
033.        schema: {
034.            data: function(data) {
035.                return data.value;
036.            },
037.            total: function(data) {
038.                return data["@odata.count"];
039.            },
040.            model: {
041.                id: "Id",
042.                fields: {
043.                    Id: { type: "number", editable: false, nullable: true },
044.                    Created: { type: "date" },
045.                    Date: { type: "date" },
046.                    UserId: { type: "string", from: "Creator.value" },
047.                    UserName: { type: "string", from: "Creator.title" },
048.                    Cost: { type: "number" },
049.                    SalePrice: { type: "number" },
050.                    InvoicedAmount: { type: "number" },
051.                    Title: { type: "string" },
052.                    Description: { type: "string" },
053.                    Approved: { type: "boolean" },
054.                    Processed: { type: "boolean" },
055.                    CompanyId: { type: "string", from: "Company.value" },
056.                    CompanyName: { type: "string", from: "Company.title" },
057.                    ProjectId: { type: "string", from: "Project.value" },
058.                    ProjectName: { type: "string", from: "Project.title" }
059.                }
060.            }
061.        },
062.        pageSize: 200,
063.        serverPaging: true,
064.        serverFiltering: true,
065.        serverSorting: true,
066.        aggregate: [
067.            { field: "Cost", aggregate: "sum" },
068.            { field: "SalePrice", aggregate: "sum" },
069.            { field: "InvoicedAmount", aggregate: "sum" }
070.        ],
071.        sort: { field: "Date", dir: "desc" }
072.    }),
073.    columns: [
074.        {
075.            field: "Id",
076.            title: "Id",
077.            hidden: true
078.        },
079.        {
080.            field: "Date",
081.            title: "Date",
082.            type: "date",
083.            template: "#= moment(Date).format('LL') #",
084.            aggregates: ["count"],
085.            footerTemplate: "TOTAL",
086.            groupHeaderTemplate: "#= moment(value).format('LL') # | Count: #= count #",
087.            groupFooterTemplate: "SUBTOTAL"
088.        },
089.        {
090.            field: "Title",
091.            title: "Title",
092.            groupable: false
093.        },
094.        {
095.            field: "Description",
096.            title: "Description",
097.            groupable: false,
098.            template: function(dataItem) {
099.                return "<small>" + (dataItem.Description || "") + "</small>";
100.            }
101.        },
102.        {
103.            field: "Cost",
104.            title: "Cost",
105.            aggregates: ["sum"],
106.            groupable: false,
107.            template: function(dataItem) {
108.                return "<div><span style='display:inline-block;width:25%;text-align:left'>" + numeral.languageData().currency.symbol + "</span><span style='display:inline-block;width:75%;text-align:right;white-space:nowrap;'>" + numeral(dataItem.Cost).format('0,0.00') + "</span></div>";
109.            },
110.            groupFooterTemplate: function(data) {
111.                return "<div><span style='display:inline-block;width:25%;text-align:left'>" + numeral.languageData().currency.symbol + "</span><span style='display:inline-block;width:75%;text-align:right;white-space:nowrap;'>" + numeral(data.Cost.sum).format('0,0.00') + "</span></div>";
112.            },
113.            footerTemplate: function(data) {
114.                return "<div><span style='display:inline-block;width:25%;text-align:left'>" + numeral.languageData().currency.symbol + "</span><span style='display:inline-block;width:75%;text-align:right;white-space:nowrap;'>" + numeral(data.Cost.sum).format('0,0.00') + "</span></div>";
115.            }
116.        },
117.        {
118.            field: "SalePrice",
119.            title: "Sale Price",
120.            aggregates: ["sum"],
121.            groupable: false,
122.            template: function(dataItem) {
123.                return "<div><span style='display:inline-block;width:25%;text-align:left'>" + numeral.languageData().currency.symbol + "</span><span style='display:inline-block;width:75%;text-align:right;white-space:nowrap;'>" + numeral(dataItem.SalePrice).format('0,0.00') + "</span></div>";
124.            },
125.            groupFooterTemplate: function(data) {
126.                return "<div><span style='display:inline-block;width:25%;text-align:left'>" + numeral.languageData().currency.symbol + "</span><span style='display:inline-block;width:75%;text-align:right;white-space:nowrap;'>" + numeral(data.SalePrice.sum).format('0,0.00') + "</span></div>";
127.            },
128.            footerTemplate: function(data) {
129.                return "<div><span style='display:inline-block;width:25%;text-align:left'>" + numeral.languageData().currency.symbol + "</span><span style='display:inline-block;width:75%;text-align:right;white-space:nowrap;'>" + numeral(data.SalePrice.sum).format('0,0.00') + "</span></div>";
130.            }
131.        },
132.        {
133.            field: "InvoicedAmount",
134.            title: "Invoiced Amount",
135.            aggregates: ["sum"],
136.            groupable: false,
137.            template: function(dataItem) {
138.                return "<div><span style='display:inline-block;width:25%;text-align:left'>" + numeral.languageData().currency.symbol + "</span><span style='display:inline-block;width:75%;text-align:right;white-space:nowrap;'>" + numeral(dataItem.InvoicedAmount).format('0,0.00') + "</span></div>";
139.            },
140.            groupFooterTemplate: function(data) {
141.                return "<div><span style='display:inline-block;width:25%;text-align:left'>" + numeral.languageData().currency.symbol + "</span><span style='display:inline-block;width:75%;text-align:right;white-space:nowrap;'>" + numeral(data.InvoicedAmount.sum).format('0,0.00') + "</span></div>";
142.            },
143.            footerTemplate: function(data) {
144.                return "<div><span style='display:inline-block;width:25%;text-align:left'>" + numeral.languageData().currency.symbol + "</span><span style='display:inline-block;width:75%;text-align:right;white-space:nowrap;'>" + numeral(data.InvoicedAmount.sum).format('0,0.00') + "</span></div>";
145.            }
146.        },
147.        {
148.            field: "CompanyName",
149.            title: "Company",
150.            aggregates: ["count"],
151.            groupHeaderTemplate: "#= value # | Count: #= count #",
152.            template: function(dataItem) {
153.                return "<a href='' ui-sref='customers.details({ id: \"" + dataItem.CompanyId + "\" })' ui-sref-opts='{ title: \"" + AttributeSanitizerFactory.escape(dataItem.CompanyName) + "\" }'>" + dataItem.CompanyName + "</a>";
154.            }
155.        },
156.        {
157.            field: "Processed",
158.            title: "Processed",
159.            aggregates: ["count"],
160.            groupHeaderTemplate: function(data) {
161.                if (data.value === true) {
162.                    return "<i class='fa fa-check'></i> | Count: " + data.count;
163.                }
164. 
165.                return " | Count: " + data.count;
166.            },
167.            template: function(dataItem) {
168.                if (dataItem.Processed === true) {
169.                    return "<i class='fa fa-check' style='display:block;text-align:center'></i>";
170.                }
171. 
172.                return "";
173.            }
174.        },
175.        {
176.            field: "Invoiced",
177.            title: "Invoiced",
178.            aggregates: ["count"],
179.            groupHeaderTemplate: function(data) {
180.                if (data.value === true) {
181.                    return "<i class='fa fa-check'></i> | Count: " + data.count;
182.                }
183. 
184.                return " | Count: " + data.count;
185.            },
186.            template: function(dataItem) {
187.                if (dataItem.Invoiced === true) {
188.                    return "<i class='fa fa-check' style='display:block;text-align:center'></i>";
189.                }
190. 
191.                return "";
192.            }
193.        },
194.        {
195.            command: [
196.                {
197.                    className: "edit",
198.                    name: "edit",
199.                    text: "<i class='fa fa-pencil'></i>",
200.                    click: editExpense
201.                }, {
202.                    className: "delete",
203.                    name: "delete",
204.                    text: "<i class='fa fa-trash-o'></i>",
205.                    click: deleteExpense
206.                }
207.            ],
208.            title: " ",
209.            width: 60
210.        }
211.    ],
212.    pageable: {
213.        info: true,
214.        numeric: false,
215.        previousNext: true
216.    },
217.    groupable: {
218.        showFooter: true
219.    },
220.    scrollable: false,
221.    sortable: true,
222.    resizable: true,
223.    filterable: false,
224.    dataBound: function(e) {
225.        var data = this._data;
226. 
227.        for (var x = 0; x < data.length; x++) {
228.            var dataItem = data[x];
229.            var tr = $(this.wrapper).find("[data-uid='" + dataItem.uid + "']");
230. 
231.            if (dataItem.Processed) {
232.                tr.find('a.k-grid-edit').remove();
233.                tr.find('a.k-grid-delete').remove();
234.            }
235.        }
236.    }
237.};

Every grid uses the same setup, only difference are the api endpoints and column setup.

This was tried with version 2015.2.624, 2015.2.​805, 2015.2.902. I've downgraded again to 2015.1.429 as everything works fine there.

 

Have anyone experienced anything similar? I cannot find anything in the release notes for the non-working versions that changes something fundamental about Grid and DataSource.

Dimo
Telerik team
 answered on 30 Sep 2015
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?