Telerik Forums
Kendo UI for jQuery Forum
1 answer
517 views
I am binding to a table using a template. The number of columns is dynamic. My data source row looks like this:
{ name: "text", flags: [ {status: true}, {status: false}, {status: false} ] }
The flags array length is the same for all rows. My desired output is something like this:
<tr>
    <td data-bind="html: name"></td>
    <td><input type="checkbox" data-bind="check: status" /></td>
    <td><input type="checkbox" data-bind="check: status" /></td>
    <td><input type="checkbox" data-bind="check: status" /></td>
</tr>
I have tried using a nested template to generate the <td> elements for each of the array items, but the problem is that this requires a containing element to apply against, as in the made up "xxx" element below:
<script id="row-template" type="text/x-kendo-template">
    <tr>
         <td data-bind=
"html: name"></td>
         <xxx data-template="flags-template" data-bind="source: flags"></xxx>
    </tr>
</script>
<script id=
"statuses-template" type="text/x-kendo-template">
    <td><input type=
"checkbox" data-bind="checked: status" /></td>
</script>
I've also tried flattening out the data source:
[ {name: "text"}, {status: true}, {status: false}, {status: false} ]
But with this approach, I can't find a way to render the first array item differently than the remaining.

Can you advise how this problem should be addressed?

Thanks,
Gary
Alexander Valchev
Telerik team
 answered on 13 Feb 2013
11 answers
301 views
How can I display TabStrip Text on Andoid.. 
it's work great on IOS.. but android only show icon

thanks
Kamen Bundev
Telerik team
 answered on 13 Feb 2013
8 answers
290 views
HI ,

I have a main menu and sub menus inside it. While I am on the third lower level of the menu, the 2 topper hierarchy is not highlight. I want the highlight remains as I move in the lower levels of the sub menu.

For example

MY first level of menu is 

ELECTRONICS      FOOD      GAMES

My second level of menu, for example, in case of ELECTRONICS is as below

COMPUTERS    TVs     SOUNDS

My third level of menu, for example, in case of COMPUTERS is as below

LAPTOPS    DESKTOPS   STORAGE

Now, if i am on the page LAPTOPS, only LAPTOPS get highlighted but the above 2, ELECTRONICS and COMPUTERS do not get highlighted.

Please let me know how I highlight all the 3 levels of the menu level


S
Top achievements
Rank 1
 answered on 13 Feb 2013
3 answers
790 views
hi,

If I have a <ul> made up of checkboxes of the same name (to prompt the user to select more then one choice via checkbox), how can I validate they did check off at least one option?

I tried putting the 'required' attribute in both the ul level and the input level... it either doesn't do anything, or it requires the user to check off every single check box (instead of just one or more).

Here's the HTML (this works fine with Radio buttons and Kendo BTW, you can change the type to RadioButton and see. but as checkbox, it breaks)

<form> 
   <!-- in this case, I set required at the ul level !-->
   <ul required="required" validationMessage="You must enter a gender">
      <li>
        <input id="male" name="mf" type="checkbox" value="Male" />
        <label  for="male">Male</label>
      </li>
      <li>
        <input id="female" name="mf"  type="checkbox" value="Female" />
        <label for="female">Female</label>
      </li>
    </ul>
   <!-- in this case, I set it at the input level -->
   <ul required="required" validationMessage="You must enter a gender2">
      <li>
        <input id="male2" name="mf2" type="checkbox" value="Male2" required />
        <label  for="male">Male2</label>
      </li>
      <li>
        <input id="female2" name="mf2" type="checkbox" value="Female2" required />
        <label for="female">Female2</label>
      </li>
    </ul>
   <input type="submit" value="submit">
  </form>
thanks!
Petur Subev
Telerik team
 answered on 13 Feb 2013
3 answers
136 views
I'm trying to use a linear guage in a template.  I have a series of records in my data source that contain a PercentFull and I want to use the Linear Guage to represent the percentage.  I'm trying to set a unique id in the template and use it after the data source gets loaded.  All the code "works" to the point of trying to create the guage.  But I just can't tell if the id is really getting set in the template and the selector is selecting it when I try to create it.  Can this be done?  Maybe I'm just doing it wrong?



    <script type="text/x-kendo-template" id="reportPackageCountTemplate">
        <a data-role="listview-link" href="\#listPackageCompanyView?id=#:PackageID#">
        Pkg #= PackageID #
        <br />
        <p id="pctFullGuage#:PackageID#" class"pctFullGuage">test:#= PackageID #</p>
    </script>

  var dsPackageData = new kendo.data.DataSource({
      schema: {
          model: PackageData
      },
      transport: packageDataTransport,
      sync: function (e) {
          window.app.navigate("#packageListView");
      },
      error: function (e) {
          alert("dsPackageData error: " + e.status + "errorThrown: " + e.errorThrown);
      },
      change: function (data) {
          InitPctFullGauge();
      }
  });

  function InitPctFullGauge() {
      var total = dsPackageData.total();
      if (total > 1) {
          var gaugeConfig = {
              pointer: {
                        value: 1
              },
              scale: {
                  min: 1,
                  max: 100,
                        vertical: false
              }
          }

          for (var i = 0; i < total; i++) {
              editPackageData = dsPackageData.at(i);
              gaugeConfig.pointer.value = editPackageData.PercentFull;
              $("#pctFullGuage" + editPackageData.PackageID).kendoLinearGauge(gaugeConfig);
          }
      }
  }

EDIT: After some further testing it seems one problem is that the change event is called and my function runs before the html is rendered with the list, so the id's are not there when the function executes.  I have examined the page source of the rendered list and the id's are there as I expect.  From that it seems I need a way/event to let me know when the listview has been rendered into html and then run my function to render the guages.  Is there anything like that?  Or do I just need to use a document ready function and look only for this one page?  Or some other way?  Thanks.
Alexander Valchev
Telerik team
 answered on 13 Feb 2013
3 answers
595 views
I was wondering if maybe someone could help me get the syntax correct to format the DateTime values on my CategoryAxis? Currently, the closest I have gotten throws an InvaidCastException, but my value is definately a datetime datatype. Any help will be appreciated, my code is below:

HomeController.cs:
using MobileChart_WithDataBind.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
 
namespace MobileChart_WithDataBind.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            var myHist = new List<ChartHist>
            {
                new ChartHist() { LoginDateTime = Convert.ToDateTime("2/6/2013 12:00:00"), LoginDuration_Fail = 3, LoginDuration_Pass=2 },
                new ChartHist() { LoginDateTime = Convert.ToDateTime("2/5/2013 12:00:00"), LoginDuration_Fail = 4, LoginDuration_Pass=2 },
                new ChartHist() { LoginDateTime = Convert.ToDateTime("2/4/2013 12:00:00"), LoginDuration_Fail = 3, LoginDuration_Pass=2 },
                new ChartHist() { LoginDateTime = Convert.ToDateTime("2/3/2013 12:00:00"), LoginDuration_Fail = 3, LoginDuration_Pass=2 }
            };
 
            return View(myHist);
        }
 
        public ActionResult About()
        {
            ViewBag.Message = "Your app description page.";
 
            return View();
        }
 
        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";
 
            return View();
        }
    }
}

Index.cshtml:
@model IEnumerable<MobileChart_WithDataBind.Models.ChartHist>
 
@{
    ViewBag.Title = "Home Page";
}
@(Html.Kendo().Chart(Model)
            .Name("chart")
            .Title("Chart Title")
            .SeriesDefaults(seriesDefaults => seriesDefaults.Column().Stack(false)
            )
            .Series(series =>
            {
                series.Column(model => model.LoginDuration_Pass).Name("Passed").Color("Lime");
                series.Column(model => model.LoginDuration_Fail).Name("Failed").Color("Red");
            })
            .CategoryAxis(axis => axis
                .Categories(model => model.LoginDateTime)
                .Title("Time of Attempt")
                .Date()
                .Labels(labels => labels
                    .DateFormats(formats => formats.Hours("HH:mm"))
                    )
            )
            .ValueAxis(axis => axis
                .Numeric().Labels(labels => labels.Format("{0:0.00}"))
                .Title("Seconds")
            )
            .Tooltip(tooltip => tooltip
                .Visible(true)
                .Format("{0} Seconds")
            )
            )
<h2>@ViewBag.Message</h2>
<p>
    To learn more about ASP.NET MVC visit <a href="http://asp.net/mvc" title="ASP.NET MVC Website">http://asp.net/mvc<;/a>.
</p>
 
<ul data-role="listview" data-inset="true">
    <li data-role="list-divider">Navigation</li>
    <li>@Html.ActionLink("About", "About", "Home")</li>
    <li>@Html.ActionLink("Contact", "Contact", "Home")</li>
</ul>
Daniel
Telerik team
 answered on 13 Feb 2013
1 answer
107 views
Hi!

I am not sure on how will I explain this.
I have a list of all the nearest addresses from a web sql and it has a specific view/template to show a single address. My case is that it is caching the first address that I am choosing. It is a sort of caching but I want to clear the content and show the other addresses into that specific view/template. I hope you've got what I mean.

Here is an example

List view:

<script type="text/x-kendo-template" id="addresses-listview-template">
        <a class="clear" data-role="listview-link" href='views/address.html?id=${id}'>${name}</a>
    </script>
    
    <!--page-addresses-->
    <div data-role="view" id="page-addresses" data-title="Addresses" data-init="getAddressesInit" data-before-show="addressesBeforeShow">
        <ul data-role="listview" data-style="inset" data-type="group">
            <li>
                <ul id="addresses-listview" data-role="listview" data-template="addresses-listview-template" data-auto-bind="false">
                    
                </ul>
            </li>
        </ul>
    </div>

Single View (Second hit will cache the first hit)

<script type="text/x-kendo-template" id="address-single-template">
        <h1>#= name #</h1>
        <p>Address: #= address #</p>
    </script>
    
    <!--page-address-->
    <div data-role="view" id="page-address" data-title="Address" data-init="getAddressInit">
        <ul id="address-single-view" data-template="address-single-template">
        
        </ul>
        <div id="map_canvas_address"></div>
    </div>

Thanks!
James
James
Top achievements
Rank 1
 answered on 13 Feb 2013
1 answer
199 views
Can you advice me, how to disable default selection in ListView in Chrome browser? When I open ListView in Chrome, the first item of ListView is selected by default. I was trying to call clearSelection on object created this way:
gListView = $("#listView").kendoListView({
    selectable: true,
    navigatable: true,
    dataSource: gDrawDataListView,
    template: kendo.template($("#template").html())
});
but when I was trying to call
gListView.clearSelection();
the object did not have this method.
What am I doing wrong?
Iliana Dyankova
Telerik team
 answered on 13 Feb 2013
3 answers
2.0K+ views
Hi,

I want that the chart to be re sized based following the browser window. I tried this code but it does not work:

jQuery(window).resize(function () {
                        control.kendoChart.refresh();
                    });
The biggest problems I have is in decreasing the size as it breaks my page layout, increasing the size keep the layout but the chart is not re sized either

I've seen possible solutions like http://www.telerik.com/community/forums/aspnet-mvc/chart/resizing-chart-on-browser-resize.aspx
but this does not work in my case as I do not have a prefixed size.

Thank for your help,
Ignacio
Iliana Dyankova
Telerik team
 answered on 13 Feb 2013
8 answers
354 views
Hi kendo users!

I have a problem with the filter on this grid:

grid declaration:
                $("#grid2").kendoGrid({
                    dataSource: {
                        transport: {
                            read: "datos/CargarTipo_Impresion_s.php" //php file with mysql sentence
                        },
                        batch: true,
                        schema: {
                            model: {
                                id: "notipoimpresion",
                                fields: {
                                    notipoimpresion: { type: "number" },
                                    descripcion: { type: "string" },
                                    nogrupo: { type: "number" },
                                }
                            }
                        },
                        //send notipoimpresion like parameter to the page : CargarTipo_Impresion_s.php
                        serverFiltering: true,
                        //filter: { field: "notipoimpresion", operator: "eq", value: "1,2" }, // with this filter is ok, show data
                        //filter: { field: "notipoimpresion", operator: "eq", value: 2 }, //with this filter is ok , show data
                        //filter: { field: "notipoimpresion", operator: "eq", value: '1,2' }, //with this filter is ok, show data

                        filter: { field: "notipoimpresion", operator: "eq", value: value_codigos_tipo_impresion }, //with this filter doesn´t show data
                        //value_codigos_tipo_impresion, can have this values: "1" or "1,2" or "1,2,4", etc.
                       //value_codigos_tipo_impresion, receive the value from a form text

in CargarTipo_Impresion_s.php use this:
$codigos_tipo_impresion = mysql_real_escape_string($_REQUEST["filter"]["filters"][0]["value"]);
and the execute a mysql sentence

Could someone tell me, why doesn´t make the filter ? or what is wrong?

Thanks
JC
JC
Top achievements
Rank 1
 answered on 13 Feb 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?