Telerik Forums
Kendo UI for jQuery Forum
2 answers
541 views
Hello,

I am trying to use/define templates based on meta-data. In the example below, I have hard coded a json array (to be replaced with remote data) that is used to populate the template, and other fields as well. While the correct templates are being invoked (identified by the for debug labels added), the date picker and drop list assigned to the data-role attribute are not functioning.

1.  the mock data is bound to a list view, which
2.  uses a template that calls a function
3.  the function calls another template which contains the datepicker.

Thanks in advance for your help.

Regards,

Amit Kohli

<div id="container">
</div>

<script type="text/x-kendo-template" id="textBoxTemplate">
<input type="text" id="txt#=columnName#">
</script>

<script type="text/x-kendo-template" id="dateTemplate">
<input name="#=columnName#" 
                type="text" 
                data-type="date" 
                data-role="datepicker" /><label>for debug - date</label>
</script>

<script type="text/x-kendo-template" id="dropListTemplate">
<input name="dll#=columnName#" id="dll#=columnName#"
        data-value-field="LookupValue"
        data-text-field="LookupName"
        data-source="#:lookupList#"
        data-value-primitive="true"
        data-role="dropdownlist" /><label>for debug - droplist</label>
</script>

<script type="text/x-kendo-template" id="outerTemplate">
    <table>
<tr>
<td>#=columnDisplayName#</td>
<td>
                #= renderEntityTemplate(data) #
            </td>
</tr>
</table>
</script>

<script type="text/javascript">
    //todo - amit k - validations for required, format, etc. ? May one assume all dates are required
    $(document).ready(function () {
        
        var mockData =
            [
                {  columnDisplayName: "Entity Code", columnName: "EntCode", templateType: "textBoxTemplate", lookupList: ""          },
                {  columnDisplayName: "Start Date", columnName: "EqEffBegDate", templateType: "dateTemplate", lookupList: ""        },
                {  columnDisplayName: "Entity Type", columnName: "EntTypeTID", templateType: "dropListTemplate",
                    lookupList: [{ "LookupValue": 1, "LookupName": "One" }, { "LookupValue": 2, "LookupName": "Two" }]
                },
            ];

        $("#container").kendoListView({
            dataSource: mockData,
            template: kendo.template($("#outerTemplate").html())
        });
    });

    function renderEntityTemplate(data) {
        //debugger;
        return kendo.Template.compile($('#' + data.templateType).html())(data);
    }
</script>
Daniel
Telerik team
 answered on 13 Jun 2014
2 answers
284 views
Hello,

I've found this post: http://www.kendoui.com/forums/ui/grid/any-filtering-event.aspx
Is there any other way to receive a filter event or a sort one? Or how to override the logic of sorting/filtering but keeping the styles applied on the grid ?
The reason I need those is the following:
I'm sorting and filtering the data on the server side since it's a server pagination one, but the problem is that I'm not using the DataSource transport method to retrieve it, because it's much more complex. I have lots and lots of configurations that need to be parsed and also data, the data is generic and it's shared among multiple visualization controls and each of them parsing  the data correspondingly etc.

So what I need is to catch some filter/sort event, stop the default behavior, call my get data methods, parse the data and reassign it to the data source, but keeping the sorting/ filtering info in the headers of the grid. With the little trick in the post above I've managed to do it, but I don't like it that much especially that in order to keep the filtering/sorting info in the columns headers of the grid, I need to reapply the sorting and filtering on the data source in the client side which I don't like.

Please let me know your thoughts,
Walid


Simon
Top achievements
Rank 1
 answered on 13 Jun 2014
3 answers
1.1K+ views
I have a template that has a multiselect control on it. I want to be able to hide it or show it dynamically.

  <script id="popup_editor" type="text/x-kendo-template">
<div id="monthlyOptions" >
      <label>Select Days of Month</label>
      <select id="daysOfMonth" name="daysOfMonth"  multiple="multiple" data-placeholder="Select Days"  data-role="multiselect">
          <option>1</option>
          <option>2</option>
          <option>3</option>
          <option>4</option>
          <option>5</option>
          <option>6</option>
          <option>7</option>
          <option>8</option>
          <option>9</option>
          <option>10</option>
          <option>11</option>
          <option>12</option>
          <option>13</option>
          <option>14</option>
          <option>15</option>
          <option>16</option>
          <option>17</option>
          <option>18</option>
          <option>19</option>
          <option>20</option>
          <option>21</option>
          <option>22</option>
          <option>23</option>
          <option>24</option>
          <option>25</option>
          <option>26</option>
          <option>27</option>
          <option>28</option>
          <option>29</option>
          <option>30</option>
          <option>31</option>
      </select>
      <span class="k-invalid-msg" data-for="daysOfMonth"></span>
          </div>      </script>

How would i gain reference to this to call show/hide on it. Im doing something similar on a form and can call $("#daysOfMonth").hide() and it works fine. Doesn't work in the popup editor however. Any clues how to do this?
Kiril Nikolov
Telerik team
 answered on 13 Jun 2014
6 answers
237 views
What is the best way to put a button on the bottom of the screen, ios style?
Kiril Nikolov
Telerik team
 answered on 13 Jun 2014
4 answers
551 views
Hi,

  I am trying to save the modified changes from kendo ui grid, but its not hitting the controller method. Here is my view code,

01.  @(Html.Kendo().Grid<Club.Models.FieldModel>()
02.      .Name("config")
03.      .Columns(columns =>
04.      {
05.          columns.Bound(s => s.Id).Hidden();
06.          columns.Bound(s => s.FieldName).Width(10).Title("Field Name");
07.          columns.Bound(s => s.isVisible).Width(10).Title("Hidden ?");
08.          columns.Bound(s => s.isReadonly).Width(10).Title("Read Only ?");
09.          columns.Bound(s => s.isMultiSelect).Width(10).Title("Single Select ?");
10.          columns.Bound(s => s.isMask).Width(10).Title("Masking ?");
11.          columns.Bound(s => s.MaskLength).Width(10).Title("Mask Length");
12.          /*columns.Command(commands =>
13.          {
14.              commands.Destroy(); // The "destroy" command removes data items
15.          }).Title("Commands").Width(200);*/
16.      })
17.      .ToolBar(toolbar =>
18.      {
19.         // toolbar.Create(); // The "create" command adds new data items
20.          toolbar.Save(); // The "save" command saves the changed data items
21.      })
22.      .Editable(editable => editable.Mode(GridEditMode.InCell)) // Use in-cell editing mode
23.      .DataSource(dataSource =>
24.          dataSource.Ajax()
25.            .Batch(true) // Enable batch updates
26.            .Model(model =>
27.            {
28.                model.Id(s => s.Id);
29.                model.Field(s => s.Id).Editable(false);
30.                model.Field(s => s.FieldName).Editable(false);
31.                model.Field(s => s.MaskLength).DefaultValue(2);
32.               
33.            })
34.           // .Create(create => create.Action("Products_Create", "Home"))
35.            .Read(read => read.Action("GetConfig", "Field",new { moduleId = 1 }))
36.            .Update(update => update.Action("ConfigsUpdate", "Field").Type(HttpVerbs.Post))
37.            //.Update(update => update.Action("ConfigsUpdate", "Field"))
38.            .Destroy(destroy => destroy.Action("Products_Destroy", "Home"))
39.            .PageSize(5)
40.      )
41.      .Pageable(pager => pager.PageSizes(new int[] {5, 10, 20}))
42.      .Filterable()
43.      .Sortable()
44.       
45.)

And my update actionmethod in the controller is,

01.[AcceptVerbs(HttpVerbs.Post)]
02.  public ActionResult ConfigsUpdate([DataSourceRequest]DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<FieldModel> fieldItems)
03.  {
04.      var entities = new List<FieldModel>();
05.      foreach (var item in fieldItems)
06.      {
07.          var entity = new FieldModel
08.          {
09.              Id = item.Id,
10.              FieldName = item.FieldName,
11.              isVisible = item.isVisible,
12.              isMultiSelect = item.isMultiSelect,
13.              isReadonly = item.isReadonly,
14.              isMask = item.isMask,
15.              MaskLength = item.MaskLength
16.          };
17.      }
18.      return Json(entities.ToDataSourceResult(request, ModelState, item => new FieldModel
19.      {
20.          Id = item.Id,
21.          FieldName = item.FieldName,
22.          isVisible = item.isVisible,
23.          isMultiSelect = item.isMultiSelect,
24.          isReadonly = item.isReadonly,
25.          isMask = item.isMask,
26.          MaskLength = item.MaskLength
27.      }));
28.  }

Daniel
Telerik team
 answered on 13 Jun 2014
2 answers
382 views
Hi,

 We have a requirement to collapse/expand TabStrip's currently selected tab using code - lets say on some button click. I already have set collapsible property as true for my Tab.
So is there any method that we can call in this case? I know the feature that clicking on tab header toggles the content - we need API for that so that we can call it from our code.

Thanks a lot,
Abhishek
Bhupendra
Top achievements
Rank 1
 answered on 13 Jun 2014
1 answer
249 views

Hello,

Let me explain my scenario for better understanding:
- my Model contains a list of products. All these products are displayed in GridView
- there is a nested detail template with TabStrip for each product
- one tab/item of this TabStrip contains all ebay auctions of this product in another GridView

ie. something like this http://demos.telerik.com/aspnet-mvc/grid/detailtemplate

My view in razor syntax:

@model List<Site.Models.Products>  // main model
[...]
 
@(Html.Kendo().Grid(Model)  // first grid which lists all products
    [...]
    .ClientDetailTemplateId("Details"// nested template
    [...]
 
<script id="Details">
    @(Html.Kendo().TabStrip()
    [...]
    .Items(items =>
    {
        [...]
        items.Add().Text("Auctions").Content(@<text>
            @(Html.Kendo().Grid(new List<Site.Models.EbayAuctions>())
            .Name("Auctions_for_#=strProductID#"// this variable is from Site.Models.Products
            .Columns(columns =>
            {
                columns.Bound(p => p.strEbayID); // this variable is from Site.Models.EbayAuctions
                [...]
Above example works fine! DataSources are read from Actions in my Controller.

But I don't want to display the strEbayID just like that, I want to display a link to the actual auction on the Ebay website.
The closest I got was this (replacing the above column):
.Columns(columns =>
{
    columns.Bound(p => p.strEbayID).ClientTemplate(
        "<a href=\"http://www.sandbox.ebay.com/itm/\">" + "#=data.strEbayID#" + "</a>"
    )
But unfortunately this doesn't work. To build the String I can use variables from the main model without a problem. But I don't know how I can use values from the nested model, ie. strEbayID here. It's displayed as undefined this way.

I couldn't solve this yet and I am running out of ideas. But I should be pretty close I guess. Can you help me?

With kind regards...

Daniel
Telerik team
 answered on 13 Jun 2014
1 answer
290 views
Hi,

I can select multiple rows in grid using the Ctrl & Mouse down.

Is it possible to select/deselect multiple rows in grid using Shift + up or down keys? if so how can i do that?

Presently, when I trying to do that, it navigates to different tab in my application.

Thanks,
Prashant
Dimiter Madjarov
Telerik team
 answered on 13 Jun 2014
1 answer
156 views
Hi,

I am tweaking my web site so that certain pages are mobile friendly.
I have been using the Kendo DropDownList on my pages and was hoping that it would render nicely on mobile devices as well.

@(Html.Kendo().DropDownListFor(m => m.Acc).OptionLabel("Select Service").BindTo(Model.AccountsList).HtmlAttributes(new { style = "width: 300px;" }))

This renders on the mobile devices but when you click on it the popup is displayed inline as it does with a normal web browser and not using the native select list that normal Select elements use on mobiles which is a lot easier to use and less buggy.

Is there a way to get the dropdownlist to render as a native select element on mobile devices instead of the fancy javascript way it uses on desktop web browsers?

This would allow me to use css rules to change the style for mobile viewing instead of rewriting the page for the mobile version to get rid of the kendo ui dropdownlists.

Thanks.
Kiril Nikolov
Telerik team
 answered on 13 Jun 2014
1 answer
394 views
I'm using the kendo.angular integration. Here's our markup using the kendo-grid directive, which works great:

    <div id="buUsers" kendo-grid="buUsers" data-k-options="kendoGridOptionsBuUsers"></div>

I need to initialize the grid with rows pre-selected. Is the code snippet below the only way to do this? Extracting data from the DOM with a jQuery selector seems kind of hacky.

    $scope.buUsers.select("tr:eq(" + (index + 1) + ")")

Here are my environment details:

OS: OS X 10.9.3
Browser: Chrome 35.0.1916.114
jQuery: 2.1.1
KendoUI: 2014.1.528

Any help would be appreciated!
Dimiter Madjarov
Telerik team
 answered on 13 Jun 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
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
ColorPicker
Pager
Styling
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
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?