Telerik Forums
Kendo UI for jQuery Forum
3 answers
386 views

Two general questions from a relative beginner at this client side SPA stuff. I've had to bridge from a variety of "demos" (for which I'm thankful) and I thank you for any assistance you can provide.

I'm attempting to generate a datasource using sql to a local database which will then be bound to a mvvm listview and rendered via user interaction

Here's the Listview segment I'm using. Note that I've created my own 'accordion like' display mechanism which toggles the "display" which is why it's set to "none" initially in the div.

<div class = "no-arrow-listview" id = "hoursCategoryAttractionsListview" style = "display:none;">
             <ul data-role="listview" data-source=" app.GeneralEstateHours_Attractions_DataFile.data" data-template="hours-template" data-style = "inset"> </ul>
 </div>

 

Here's the code I'm working on to generate the datasource for the listview

app.GeneralEstateHours_Attractions_DataFile = {
            data: new kendo.data.DataSource({
               transport: {
                       read:  function(options) {
                       app.db.transaction(function(tx) {
                                    tx.executeSql('SELECT * from masterDataTable where appMapCategoryID = ? ', [ 'Attraction'],
                                                function(tx, result){
                                                            var data = [];
                                                            for (var i = 0; i < result.rows.length; i++){
                                                                        data[i] = result.rows.item(i);
                                                 }
                                                options.success(data);
                                    });
                        });
                  }
            },
            group: {
                        field: "appMapCategoryID"

            },
            sort:  {
                        field: "appListOrder", dir: "asc"
            }
            })
    };  

The issue is that if I omit the "group" filter from the datasource (though I can verify that there is a valid result set returned via the fetch function and some console output listed below) the listview does not display anything. Whereas, if I include the group filter (as I did in the code above) it does indeed render the listview but adds a header to the listview and I don't want to include the "header" that is generated by using the 'group' filter.

If I can't work with the raw return is there away to remove the "listview header" from the generated listview .


     app.GeneralEstateHours_Attractions_DataFile.data.fetch(function(){
            var test = app.GeneralEstateHours_Attractions_DataFile.data.view();
            //alert ("The length of attractions is " + test.length);
            for (var i = 0; i<test.length; i++){

          console.log("From the Fetch of the new GeneralEstateHours_Attractions_DataFile Data source we have " + test[i].title + "image" + test[i].image + " id = " + test[i].id + "");
        }
       });

Stefan
Telerik team
 answered on 20 Oct 2016
1 answer
267 views

Hi I am having a bit of an issue.

I am trying to move the headers down the left i am trying to create something like this - 

Title              Value

created         11/05/2016

Duration        11:05:20

FPS               60

I have attached a screenshot.

I really want all my items to be the same hence why I want it as a kendo grid.

 

Any help would be appreciated.

 

 

 

Dimiter Madjarov
Telerik team
 answered on 20 Oct 2016
4 answers
1.2K+ views
I want to initialize the scheduler in the beginning of my app (in the jquery ready handler) and when I get a list of something comparable to "owners" in

http://demos.telerik.com/kendo-ui/web/scheduler/index.html

I want to set the resources.dataSource member (the one with Alex, Bob and Charlie, but in my case, there are some other owners, data coming from an ajax response).

I tried to create an array of items all having the members text, value and color, and then

var scheduler = $("#wScheduler").data("kendoScheduler");
scheduler.resources[0].dataSource = theArray;
scheduler.dataSource.sync();

but that did not change the possible "owners" of scheduler tasks.

I have also tried

var ds = new kendo.data.SchedulerDataSource({data:items});
scheduler.resources[0].dataSource = ds;

and

var ds = new kendo.data.DataSource({data:items});
scheduler.resources[0].dataSource = ds;

with no luck.
Georgi Krustev
Telerik team
 answered on 20 Oct 2016
5 answers
384 views

Hi, I am using the upload widget with angular. 

I am looking for it to achieve the following:

1) have something like k-files = "initialFiles" in the input options; to display list of previously loaded files. 

I tried using k-files along with in javascript code; but that does not work.. how do I make this feature work? 

2) Is there a way to use template (again using angular) to make the previously uploaded files downloadable? I saw a similar post but it had no examples. Can you give a small example on how to do this? 

Thanks

$scope.initalFiles = [ { name:"test1.txt" }, {name: "test2.txt" } ];
<p><input name="files"<br>    id="files"<br>    type="file"<br>    kendo-upload="uploader"<br>    k-select="onSelect"<br>    k-success="onSuccess"</p><p>k-files = "initialFiles"</p><p>    k-async="asyncOptions"/></p>
Dimiter Madjarov
Telerik team
 answered on 20 Oct 2016
9 answers
1.2K+ views
Dear all,
             i'd tried the samples of Treeview 
but the filter is able to filter only the parent node 
but i want to filter parent node and as well as child node too
could anyone give me the samples of this thread
thanks in advance
Kiril Nikolov
Telerik team
 answered on 20 Oct 2016
1 answer
300 views

The titles on Row 1 seem to be set to what's coming down from the service, how can I customize them?  Like the JSON is "studyId" but the client wants "Study_ID".

Is this possible?  I tried setting the cell value property but doesn't seem to work.

Alex Hajigeorgieva
Telerik team
 answered on 19 Oct 2016
1 answer
93 views
Hi, can I ask is it possible to modify or change the dragged header like the image attached? Wish to allow user to select their own aggregates and group them by their own. An example provided would be great if it is possible to do so.
Alex Hajigeorgieva
Telerik team
 answered on 19 Oct 2016
1 answer
404 views

I am using 3 Kendo grids.

Each grid has the ability to Export to Excel using toolbar template. 

This was all working until recently. Now it does not work on any grid. 

I am not sure what environmental issue I created. 

Here is the code. 

 

BundledConfig:

  //Telerik 
            bundles.Add(new ScriptBundle("~/bundles/kendo").Include(
                "~/Scripts/kendo/kendo.all.min.js",
                "~/Scripts/kendo/kendo.web.min.js",
                "~/Scripts/kendo/kendo.aspnetmvc.min.js",
                 "~/Scripts/jszip.min.js"));

View:

   <div class='pull-left'>
        <a class="k-button k-button-icontext" href="javascript:void(0)" onclick="customCommand()"><span class="k-icon k-add"></span>Add new transfer</a>
        <button class="k-button k-button-icontext k-grid-excel" type="button"><span class="k-icon k-i-excel"></span>Export to Excel</button>
        <button class="k-button k-button-icontext k-grid-pdf"><span class="k-icon k-i-pdf"></span>Export to PDF</button>

@helper ToolbarTemplate2()
{
    <div class='pull-left'>
        <button class="k-button k-button-icontext k-grid-excel" type="button"><span class="k-icon k-i-excel"></span>Export to Excel</button>
        <button class="k-button k-button-icontext k-grid-pdf"><span class="k-icon k-i-pdf"></span>Export to PDF</button>
    </div>
}

@(Html.Kendo().Grid<TransferView>()
                    .Name("grid")
                    .Columns(columns =>
                    {
                        columns.Bound(e => e.TransferId).Title("ID").Width(60);
                        columns.Bound(e => e.FromDescription).Width(180);
                        columns.Bound(e => e.ToDescription).Width(180);
                        columns.Bound(e => e.FromDept).Width(120);
                        columns.Bound(e => e.ToDept).Width(120);
                        columns.Bound(e => e.CreateDate).Hidden();
                        columns.Bound(e => e.CreateProfile).Hidden();
                        columns.Bound(e => e.ChangeDate).Hidden();
                        columns.Bound(e => e.ChangeProfile).Hidden();
                        columns.Bound(e => e.ApprovalFlag).Hidden();
                        columns.Bound(e => e.ApprovalDate).Hidden();
                        columns.Bound(e => e.ApprovalProfile).Hidden();
                        columns.Bound(e => e.PostedDate).Hidden();
                        columns.Bound(e => e.PostedFlag).Hidden();
                        columns.Bound(e => e.ReceivedDate).Hidden();
                        columns.Bound(e => e.TrnComment).Hidden();
                        columns.Command(command =>
                        {
                            command.Custom("Edit").Click("showDetails");
                            command.Custom("Delete").Click("deleteTransfer").HtmlAttributes(new { @style = "border-color: #b92c28; background-color: #d9534f; color:white" });
                        }).Width("20%");
                    })
                    .Sortable()
                    .Filterable(ftb => 
                    {
                        ftb.Mode(GridFilterMode.Row);
                    })
                .ColumnMenu()
                .ToolBar(toolbar =>
                {
                toolbar.Template(@<text>@ToolbarTemplate()</text>);
                })
                .Sortable()
                .Pageable()
                .Scrollable(a => a.Height("auto"))
                .Resizable(resize => resize.Columns(true))
                .Excel(excel => excel
                        .FileName("alltransfers.xlsx")
                        .Filterable(true)
                        .AllPages(true)
                      )
                .Groupable()
                .Reorderable(Reorder => Reorder.Columns(true))
                .Navigatable()
                .Pageable(pager => pager.PageSizes(new[]
                    {
                        10,
                        20,
                        30,
                        40,
                        50,
                        100
                    }))

                .ClientDetailTemplateId("template")
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(10)
                    .Read(read => read.Action("GetAllTransfersForStore", "Transfer"))
                )
                .Events(events => events
                  .DataBound("dataBound")
                  .DetailExpand("detailExpand"))
)

<script id="template" type="text/kendo-tmpl">
    @(Html.Kendo().TabStrip()
            .Name("tabStrip_#=TransferId#")
            .SelectedIndex(0)
            .Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
            .Items(items =>
            {
            items.Add().Text("Transactions")
                .Content(
                @<text>
                    @RenderTabStrip()
                </text>);
                items.Add().Text("Transfer Information").Content(
                       "<div class='row'>" +
                        "<div class='col-md-4'>" +
                            "<ul>" +
                                "<li><label>Created Date</label> #= CreateDate #</li>" +
                                "<li><label>Created By</label> #= CreateProfile #</li>" +
                                "<li><label>Changed Date</label> #= ChangeDate #</li>" +
                                "<li><label>Changed By</label> #= ChangeProfile #</li>" +
                                 "<li><label>Received Date </label> #= ReceivedDate #</li>" +

                            "</ul>" +
                        "</div>" +
                        "<div class='col-md-4'>" +

                            "<ul>" +

                            "<li><label>Approval Yes/No</label> #= ApprovalFlag #</li>" +
                            "<li><label>Approval Date</label> #= ApprovalDate #</li>" +
                             "<li><label>Approval Profile</label> #= ApprovalProfile #</li>" +
                            "<li><label>Posted Date</label> #= PostedDate #</li>" +
                            "<li><label>Posted Yes/No</label> #= PostedFlag #</li>" +
                        "</ul>" +
                        "</div>" +
                    "</div>"

                          );

            })
            .ToClientTemplate())}

    @helper RenderTabStrip()
    {    @(Html.Kendo().Grid<TransferLine>()
                .Name("grid_#=TransferId#")
                .Filterable(ftb => ftb.Mode(GridFilterMode.Row))
                .ColumnMenu()
                .ToolBar(toolbar =>
                 {
                     toolbar.Template(@<text>@ToolbarTemplate2()</text>);
                 })
                .Sortable()
                .Pageable()
                .Resizable(resize => resize.Columns(true))
                .Scrollable(a => a.Height("auto"))
                .Groupable()
                .Reorderable(Reorder => Reorder.Columns(true))
                .Navigatable()
                .Pageable(pager => pager.PageSizes(new[]
                    {
                        10,
                        20,
                        30,
                        40,
                        50,
                        100
                    }))
                .Columns(columns =>
                {
                    //columns.Bound(e => e.FromStoreNumber).Hidden();
                    //columns.Bound(e => e.T).Hidden());
                    //columns.Bound(e => e.FromDept).hidden();
                    //columns.Bound(e => e.ToDept).hidden();
                    columns.Bound(e => e.TransferId).Title("ID").Width(70);
                    columns.Bound(e => e.ItemUpc).Title("UPC").Width(500);
                    columns.Bound(e => e.Quantity).Width(120);
                    columns.Bound(e => e.UnitPrice).Width(120);
                    columns.Bound(e => e.ItemUOM).Width(120);
                    columns.Bound(e => e.ExtendedPrice).Format("{0:C}").Width(120);
                    columns.Bound(e => e.TrnComment).Hidden();
                    //columns.Command(command =>
                    //{
                    //    command.Custom("Delete").Click("deleteLine");
                    //}).Width("20%");

                })
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(10)
                .Read(read => read.Action("GetAllLinesForId", "Transfer", new { id = "#=TransferId#" }))

                )
                .Pageable()
                .Sortable()
                .ToClientTemplate())
}
</script>

Any ideas would be appreciated. 

 

 

 

Stefan
Telerik team
 answered on 19 Oct 2016
2 answers
324 views

Hi,

I have a mobile navbar / toolbar. It only has one item, but is showing an empty Overflow Anchor (see image attached). How can remove the overflow anchor? (Or is there some method to flag for it to auto-hide itself when it's empty?)

I'm trying to adapt the Kendo Mobile demo here: http://demos.telerik.com/php-ui/m/index#navbar/adaptive-toolbar

My code follows.

Thanks.

-Paul

01.<div data-role="toolbar" style="min-width: 600px;" data-items='[
02.  {
03.    type: "splitButton",
04.    id:   "userDisplayName",
05.    icon: "contacts",
06.    text: "Joe User",
07.    align:"right",
08.    overflow: "never",
09.    menuButtons: [
10.      {
11.        id:  "editProfile",
12.        icon: "settings",
13.        text: "edit profile"
14.      },
15.      {
16.        id:   "logout",
17.        icon: "history",
18.        text: "Logout"
19.      }
20.    ]
21.  }        
22.]'>
23.</div>
ptw
Top achievements
Rank 1
 answered on 19 Oct 2016
1 answer
1.0K+ views

In my cshtml, I am rendering a template that will be used via javascript.

<script id="my-template" type="text/x-kendo-tmpl">
    <select id="myType">
        @foreach (var src in Model.MyTypes)
        {
            <option value="@Html.Raw(@src.Key)">@Html.Raw(@src.Value)</option>
        }
    </select>
</script>

Note that I'm using @Html.Raw to output the value and text of the select items. This is necessary because we support several languages and without the @Html.Raw, the result is an invalid template.

If I keep the @Html.Raw, I'm exposing a potential hole for XSS because this data is supplied by the user.

How can I allow multiple locales and not expose an XSS vulnerability (without having to encode the data stored in the DB)?

Thanks,

--Ed

Ivan Danchev
Telerik team
 answered on 19 Oct 2016
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
Drag and Drop
Application
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
DropDownTree
ListBox
PDFViewer
Sparkline
ActionSheet
TileLayout
PopOver (Mobile)
TreeMap
ButtonGroup
Styling
ColorPicker
Pager
Chat
MultiColumnComboBox
Dialog
DateRangePicker
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Accessibility
Effects
Licensing
PivotGridV2
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
LLM Kit
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?