Telerik Forums
Kendo UI for jQuery Forum
1 answer
118 views

I have a Kendo grid that displays the Grid with Details being a Tab.  The first tab basically renders a different partial view based on the Row's StatusID column.  The "if" condition within the .Content() method of the tab item script in the template just does not work.  The if condition is always false and falls into the “else” block.  Is there a specific syntax to get the parent field's value to compare? I tried using the escape characters \\ before the pre-processor character #

 

Thanks!

 

    @(Html.Kendo().Grid(Model)

    .Name("Grid")   

    .Columns(columns =>

    {

        columns.Bound(p => p.Name).Groupable(false);

        columns.Bound(p => p.StatusName).Width(100);       

        columns.Bound(p => p.Description).Title("Description").Width(150);

        columns.Bound(p => p.City).Width(100);

        columns.Bound(p => p.State).Width(70);

        columns.Bound(p => p.AssignedTo);

        @*

        columns.Command(command => command.Custom("View Details").Click("showDetails"));

        *@

 

    })

        .ClientDetailTemplateId("detailsTemplate")

        .Pageable()

        .Sortable()

        .Scrollable(src => src.Height(500))

        .Filterable()

             .DataSource(dataSource => dataSource

                .Ajax()

                .Read(read => read.Action("ViewDetails", "Site"))

                .PageSize(20)

             )

             .Events(events =>

                    {

                        events.DataBound("dataBoundDetails");

                        events.DetailExpand("expandDetails");

                    })

    )

@(Html.Kendo().Window().Name("Details")

        .Title("Site Details")

    .Visible(false)

    .Modal(true)

    .Draggable(true)

    .Width(500)

)

 

<script id="detailsTemplate" type="text/kendo-tmpl">

   

    @(Html.Kendo().TabStrip()

            .Name("TabStrip_#=Id#")

            .SelectedIndex(0)           

            .Items(items =>

            {  

                //Main            

                items.Add()

                    .Text("Details")

                    .Encoded(false)                 

                    .Content(@<text>

                    @if("#= StatusId #" == "1")

                    {                                     

                        @Html.Action("SiteRequestView", "Site")

                       

                    } 

                    else

                    { 

                        @Html.Action("EvaView", "Site")

                    }

 

                    </text>);                                                          

               })

            .ToClientTemplate())

</script>

Daniel
Telerik team
 answered on 04 Mar 2013
1 answer
129 views
I have a datasource setup (JSON) to populate a grid...Maybe I am missing something simple, but since the grid will be populated by the results of a query, the number of titles (and of course data type) for each column will change just about each time a query is run.  How do I programmatically set the column headers and associated details based on the returned JSON?
Alexander Valchev
Telerik team
 answered on 04 Mar 2013
1 answer
350 views
I have a simple grid bound to server data (asp.net mvc). I noticed that in IE8 (or IE9 compatibility view), the grid column headers don't respect the width settings. However, the actual column data does. See attached image (grid not aligned.png).
Here's my razor code - 
<div id = "griddisplay">
         @(Html.Kendo().Grid(Model)
            .Name("MyGrid")
            .Columns(columns =>
                {
                    columns.Bound(p => p.RegionId).Title("Region ID").Width("100px");
                    columns.Bound(p => p.RegionName).Title("Region Name").Width("150px");
                })
            .Pageable()
            .Resizable(r=>r.Columns(true))
            .Sortable()
            .Scrollable(scr => scr.Height("200px"))
            .DataSource(dataSource => dataSource
                .Ajax()
                .Read(read => read.Action("GridTest", "MyController")
                )
            )
         )
    </div>
The only style I have applied is this -
#griddisplay {width:520px;font-size:12px}
I did notice that -
1) It works correctly in IE9 and Chrome all the time (with our without resizable() configuration).
2) I want my column non-resizable. But if I make them resizable, then initially the columns render mis-aligned (in IE8) as in the image but as soon as I try to resize a column by dragging the column header, they all immediately line up correctly. So, it's just the initial layout that is not respecting the width settings I believe.

I'm using the Kendo mvc library version 2012.3.1315.340 (trial version).

Any idea of what I need to do to make it work in IE8?
Dimo
Telerik team
 answered on 04 Mar 2013
3 answers
75 views
I read some data via Ajax as follows.

var data = {
   id: 4711,
   task: {
      name: "coding"
   }
};
var options1 = {
   type: "POST",
   dataType: "json",
   contentType: "application/json",
   data: JSON.stringify(data)
};
 
$.ajax("/api/Person/", options1);

This works perfectly. Then I try to do the same with a datasource.

var options2 = {
   transport: {
      read: {
         url: "/api/Person/",
         type: "POST",
         dataType: "json",
         contentType: "application/json",
         data: JSON.stringify(data)
      }
   }
};
 
var datasource = new kendo.data.DataSource(options2);
datasource.read();

As it fails, I also tried to remove the "JSON.stringify". However, that one also fails. Looking at the request's body with Fiddler, I see

Reading via Ajax
   {"id":4711,"task":{"name":"coding"}}
 
Reading via Datasource (with stringify)
   0=%7B&1=%22&2=i&3=d&4=%22&5=%3A&6=4&7=7& (rest stripped)
 
Reading via Datasource (without stringify)
   id=4711&task%5Bname%5D=coding

Michael G. Schneider
mgs
Top achievements
Rank 1
 answered on 04 Mar 2013
1 answer
165 views
I have a popup editor for a grid

<

 

 

script id="TopRoleEditorTemplate" type="text/x-kendo-template">

 

<table >

<tr>

<td align="right">

<label for="RoleCode" class="k-Label">

<span id="rolename" style="padding: 0px 1px 0px 1px; font-family: Verdana; color: Red; font-size:xx-small; font-weight:bold">* </span>

Service Owner Group:</label>

</td>

<td>

<input type="RoleCode" id="RoleCode" name="RoleCode" class="k-textbox" style="width: 200px" data-bind="value:RoleCode"

required validationMessage="Service Owner Group is required" />

 

 

<span class="k-invalid-msg" data-for="RoleCode"></span>

 

 

</td>

</tr>

when the popup is submitted i can see a div is generated with a hard coded margin (0.5em) , becuase of this the validation message appears away from (not inline) the input control

<div class="k-widget k-tooltip k-tooltip-validation k-invalid-msg" role="alert" style="margin: 0.5em; display: block;" jQuery18206744028167790009="318" data-for="RoleScope">

how do i override the margin?
Alexander Valchev
Telerik team
 answered on 04 Mar 2013
3 answers
734 views
Hello everyone,

first of all, nice job and good luck with the development of Kendo UI. it has made our lives easier in many ways.

I am building a web application and need multi-language support in client-side. I am using Kendo UI / JQuery and for the language part i chose this library which is actually a JQuery plugin, so it should have full compatibility with Kendo UI.

So, imagine we have the following html:
<ul id="menu">
    <li lang="en"> Home </li>
    <li lang="en"> Profile </li>
     <li>
      <div id="search-box">
        <input type="text" id="searchfor" class="k-textbox" />
        <button class="k-button" id="search" lang="en">search</button>
      </div>
     </li>
     <li>
      <select id="select_lang">
       <option lang="en" value="en"> English </option>
        <option lang="en" value="gr"> Greek </option>
      </select>
     </li>
</ul>

and in javascript: 
window.lang = new jquery_lang_js();  // Create translator
$(document).ready(function() {
    $("#menu").kendoMenu();
    $("#select_lang").kendoDropDownList({
        change: onLangChange       
    });
    window.lang.run();  //start translator
                                 
    function onLangChange() {
        var value = $("#select_lang").val();
        window.lang.change(value);
        //var dropDownLanguage = $("#select_lang").data("kendoDropDownList");
        //dropDownLanguage.refresh();
    }
 });

Translations are stored in a seperate file (in our case that would be gr.js - since english is the default defined in html) in the form:
jquery_lang_js.prototype.lang.gr = {
  'Home': 'Αρχική Σελίδα',
  'Profile': 'Προφίλ',
  'World Events': 'Παγκόσμια Γεγονότα',
  'Documents': 'Έγγραφα',
  'Organizations': 'Οργανώσεις',
  'search': 'αναζήτηση',
  'English': 'Αγγλικά',
  'Greek': 'Ελληνικά'
}

The problem is: Of all the translations that should happen, only the "search" is translated... The other strings are left untouched. I thought of refreshing a Kendo element so it renders the new values, but uncommenting the two lines in onChange() function doesn't change a thing...

Any ideas?

Thank you,
fedon
Iliana Dyankova
Telerik team
 answered on 04 Mar 2013
3 answers
429 views
Hi

How is the correct way to get some return value from a modal window that contains "external" HTML loaded with the "content:" property?

in page1.html I create my window:

<div id="kw" />
    var kendoWindow = $("#kw").kendoWindow({
    content: "Page2.html",
    close: function (e) { alert('closed'); }
        });


page2.html is sometyhing like this:

<input id="number" value="123" />
<buton id="ok">OK</button>

After the window is closed, how can I access the value of #number ?

Thank you
Alex Gyoshev
Telerik team
 answered on 04 Mar 2013
1 answer
181 views
I have looked at the documentation for data binding and  i understand kendo ui supports inline(local) and remote data banding(ajax)
Given that kendo ui is built on top of javascript (jquery)  and the data formats that it expects (json,xml,odata) i think it is highly unlikely that it supports direct data binding with relational database(like oracle, db2 , mssql) directly. I am aware of some dbs like Mongo db that provide direct binding with javascript (through node.js but that is not really a client)

The only possibility i see here is routing via traditional approach i.e, a server component makes sql queries and expose the data via REST and the client(kendoui) access the REST using remote data binding. Are there any alternate ways?  Can you confirm?
Atanas Korchev
Telerik team
 answered on 04 Mar 2013
2 answers
145 views
Hi,
I attached the project (it is RTL type and I just changed the texts to English),

As you can see, the datepicker is working in the Index view (main menu page) and it doesn't within partial view called dynamically (from Run item).

Please, help a.s.a.p.

Thanks
Shabtai
Shabtai
Top achievements
Rank 1
 answered on 04 Mar 2013
1 answer
229 views
hi ,my question involves the validation of a cascade combobox.

i have a form with 3 cascade comboboxes as shown below and the second combobox is cascading from the selection of the 1st and in the same manner teh third is cascading of the second ,
The second and the third combobox is disabled till u make a selection on the first.
The problem is there are times that the second or the third data array may not match anything from the selection of the 1st combobox so they stay disabled , my issue is that the validation needs them to be completed even though they are disabled .
So my question is regardless of how many of the comboboxes are filled up is there any way to make the validation procceed?
because if i have no valid match for the second or the third combobox it doesnt proceed.
i want in the case that a selected option of the 1st combobox is filled up and theres nothing for the combobox no2 and no3. to finish the validation there.

<uL>
<li>
                                                    <label for="Text1">Χώρα</label>
                                                    <input id="Text1" class="comboInput" role="combobox" style="width:250px" required validationMessage="παρακαλώ συμπληρώστε τη {0}"/>
                                                </li>
                                                <li>
                                                    <label for="Text2" role="status">Νομός</label>
                                                    <input id="Text2" class="comboInput" disabled="disabled" style="width:250px" role="combobox" required validationMessage="παρακαλώ συμπληρώστε τη {0}"/>
                                                </li>
                                                <li>
                                                    <label for="Text3" role="status">Πόλη / Περιοχή</label>
                                                    <input id="Text3" class="comboInput" disabled="disabled"style="width:250px"  role="combobox" required validationMessage="παρακαλώ συμπληρώστε τη {0}"/>
                                                </li>
</li>

<script>
$(document).ready(function () {
                                                    $("#Text1").kendoComboBox({
                                                        placeholder: "Επιλέξτε χώρα...",
                                                        dataTextField: "CategoryName",
                                                        dataValueField: "value",
                                                        dataSource: [
                                                            { CategoryName: "Πράσινο", value: "1" },
                                                            { CategoryName: "Μώβ", value: "2" },
                                                            { CategoryName: "Κανελί με βούλες", value: "3" },
                                                            { CategoryName: "Κίτρινο", value: "4" }
                                                        ],
                                                        serverFiltering: false,
                                                    });

                                                    var products = $("#Text2").kendoComboBox({
                                                        autoBind: false,
                                                        cascadeFrom: "Text1",
                                                        placeholder: "Επιλέξτε Νομό...",
                                                        dataTextField: "ProductName",
                                                        dataValueField: "value",
                                                        dataSource: [
                                                            { ProductName: "Μπλέ", value: "1" },
                                                            { ProductName: "Πράσινο", value: "1" },
                                                            { ProductName: "Φούξια", value: "1" },
                                                            { ProductName: "Κόκκινο της φωτιάς", value: "4" }
                                                        ],
                                                        serverFiltering: false,
                                                    }).data("kendoComboBox");

                                                    var orders = $("#Text3").kendoComboBox({
                                                        autoBind: false,
                                                        cascadeFrom: "Text2",
                                                        placeholder: "Επιλέξτε Πόλη/περιοχή...",
                                                        dataTextField: "Painting",
                                                        dataValueField: "value",
                                                        dataSource: [
                                                            { Painting: "Χωρίς", value: "1" },
                                                            { Painting: "Ροζ φούσκες", value: "1" },
                                                            { Painting: "Αστέρια", value: "1" },
                                                            { Painting: "Cartoon", value: "4" }
                                                        ],
                                                        serverFiltering: false,
                                                    }).data("kendoComboBox");
                                             
});
Alexander Valchev
Telerik team
 answered on 04 Mar 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?