Telerik Forums
Kendo UI for jQuery Forum
2 answers
350 views
Here is my situation: 

I have a kendo dropdown list box and a numeric text box in a view. When the user clicks a button, i want to display a kendo grid in a popup window. 
All i need to do is figure out how to pass the values from the dropdown and textbox to my mvc controller.

Here is the definition of the dropdown and text box:

@Html.Kendo().DropDownListFor(x => x.TrainList).BindTo(Model.TrainList).HtmlAttributes(new { style = "width:150px" }).DataTextField("CNX_AUT").DataValueField("Id").Name("trainList").Value("Id").Text("CNX_AUT")
 
@Html.Kendo().NumericTextBoxFor(x => x.BeltScaleWeight).Name("beltScaleWeight").HtmlAttributes(new { style = "width:150px" })
Here is the button definition that will display the pop up window: 
<button class="k-button" id="applyToCars" style="width:150px" >Apply To Cars</button>

Here is the definition for my grid inside the pop up window's div:
<div id="GridWindow">
      <br/>
      <br/>
       @(Html.Kendo().Grid<CNX.Domain.Entities.EDIRailcar>()
          .Name("RailCarGrid")
          .Columns(columns =>
            {
                columns.Bound(o => o.Id).Visible(false);
                columns.Bound(o => o.EDI_417_TRAIN_GUID).Visible(false);
                columns.Bound(o => o.EQUIPMENT_INITIAL);
                columns.Bound(o => o.EQUIPMENT_NUMBER);
                columns.Bound(o => o.WEIGHT);
                columns.Bound(o => o.TARE_WEIGHT);
                columns.Bound(o => o.AS_RECEIVED_WEIGHT);
                columns.Bound(o => o.Pile);
                columns.Bound(o => o.Class);
                columns.Bound(o => o.STATUS);                           
            })
            .DataSource(dataSource => dataSource.Ajax()
                                                .PageSize(10)
                                                .Read(read => read.Action("ApplyWeights", "MenuWeight")
                                                .Type(HttpVerbs.Post))
                                                .Model(model => model.Id(o => o.Id)))                                               
            .Pageable()
            .Sortable()           
            .Filterable()    
         
        )
    </div>



Here is the javascript/jquery from my view : 

<script type="text/javascript">
 
    $(document).ready(function () {
       var win = $("#GridWindow").kendoWindow({
            actions: ["Maximize", "Minimize", "Close"],
            draggable: true,
            height: "500px",
            width: "500px",
            modal: true,
            resizable: true,
            visible: false,
            position: { top: 100, left: 100 }
        }).data("kendoWindow");
    });
 
    $("#applyToCars").click(function () {
        var selectedTrain = $("#trainList").data("kendoDropDownList");
        var weightValue = $("#beltScaleWeight").data("kendoNumericTextBox");
        var win = $("#GridWindow").data("kendoWindow");
        var grid = $("#RailCarGrid").data("kendoGrid");
       /*How do i pass the values they selected to the controller? */
        grid.dataSource.fetch();
        win.title('Railcar weights for ' + selectedTrain.text()  );
        win.center();
        win.open();
    });
 
 
</script>

Kinda under the gun on this one as far as time is concerned. Any help would be most appreciated.
 
Matt Miller
Top achievements
Rank 1
 answered on 24 Oct 2013
1 answer
388 views
Hi All ,

Please help me ......

I have a kendo grid and i have bind it a controller function , there is a document filed(Attachment Name) in it and it is showing different document name Now i wil have to add a image on the basis of document in each row corresponding document name . and i have written a function in controller  that is returning a string image path . I just want to call a function in grid column and bind it into a image URl of image control .

 $.ajax({
                type: "POST",
                "url": '@Url.Action("TSController", "TSFunction")',
                "data": data,
                "dataType": this.datatype,
                "contentType": "application/json; charset=utf-8",
                "success": function (data) {

                    if (data.length > 0) {

                        $("<div/>").appendTo(e.detailCell).kendoGrid({
                            dataSource: data,
                            columns: [
                             {
                         title: "",width: 30,template: "<img src='../../Images/accent.png' width='10px' height='10px'/>"
                    },
                    {
                        field: "DocName", title: "Attachment Name"
                    },
                    {
                        field: "DocPrimaryId", title: "DocumentId", hidden: true
                    },
                    {
                        field: "TSd", title: "TSd", hidden: true
                    },
                    {
                        field: "AttachmentType", title: "Attachment Type"
                    },
                    {
                        command: { text: "Re-Link Attachment",
                            click: RelinkAttachment,
                            title: "Action",
                            width: "140px"
                        }
                    },
                    {
                        command: { text: "Download",
                            click: DownloadAttachment,
                            title: "Action",
                            width: "140px"
                        }
                    },
                   {
                       command: { text: "Delete",
                           click: DeleteAttachment,
                           title: "Action",
                           width: "140px"
                       }
                   }
                    ]
                        })
                    }
                    else {

                    }
                },
                error: function (result) {
                    var data = jQuery.parseJSON(result);
                    alert("Error :" + data);
                }
            });
Ignacio
Top achievements
Rank 1
 answered on 24 Oct 2013
1 answer
86 views
Is there a way to add methods to a Model's definition after it's already been defined?

I have a Product Model that is reused throughout my application. There a form when which I bind to this Product model in my app that needs a few extra methods on it so for the "Save" button using MVVM. However I don't want to add this to the Product Model definition because this particular form is the only one that needs the "Save" method.

Here is the jsfiddle working, without adding the Save function to the Model
http://jsfiddle.net/lelong37/RvsCg/1/

Here is the jsfiddle not working when I try to add the Save method to the Model
http://jsfiddle.net/lelong37/t8Bq2/3/

Your help is greatly appreciated.
Daniel
Telerik team
 answered on 24 Oct 2013
1 answer
75 views
Having trouble with a chart using groupings and aggregates.
If I build the chart using javascript, I can get the seriesColors to work just fine ( http://jsbin.com/upoPuqI/2/edit )
seriesColors: [ 'yellow','red','green']
But if I build the chart using MVVM, I can't get the colors to work ( http://jsbin.com/OquRoYA/3/edit ).
data-series-colors:"['yellow','red','green']"

I think I've gotten this to work before, but for the life of me can't figure this one out.
Robin
Top achievements
Rank 1
 answered on 24 Oct 2013
1 answer
38 views
I started with the demo here: http://demos.kendoui.com/mobile/view/index.html#/ 
and modified the source very slightly to look like: 
<div data-role="view" data-title="Views" data-layout="main-default">
    <a href="page2.html" id="broken">Remote View</a>
    <ul data-role="listview" data-style="inset" data-type="group">
        <li>Sources
            <ul>
                <li><a href="#secondview">Local View</a></li>
                <li><a href="page2.html" id="works">Remote View</a></li>
            </ul>
        </li>
    </ul>
 
    <ul data-role="listview" data-style="inset" data-type="group">
        <li>Types
            <ul>
                <li><a href="#stretchview">Stretched View</a></li>
            </ul>
        </li>
    </ul>
</div>
The first <a> tag that references page2.html with id="broken" opens the new page outside the kendo application. It takes the browser directly to that HTML page.

The second <a> tag that references page2.html with id="works" does in fact work correctly.

Why is this?


Thanks
Petyo
Telerik team
 answered on 24 Oct 2013
1 answer
164 views
Hello,

I am implementing a ComboBox and I need to do something when the user manually removes the text from the ComboBox.  

Can you help me figure out the appropriate event if there is one?

I have tried using the change event (code below) but it is not fired when the user manually removes text.

Thanks,
Carrie
change: function (e) {
      if (this.select() < 0) {
         //do something here
      }
  }
Dimiter Madjarov
Telerik team
 answered on 24 Oct 2013
2 answers
298 views
Using the DataViz bar charts, is there a way to display the x-axis text on the top of the chart?  (Similar to the attachment)
STATE OF WASHINGTON
Top achievements
Rank 1
 answered on 24 Oct 2013
4 answers
336 views
Hi,

I’m currently testing KendoUI for a future project and I have a little issue with the DatePicker. Let me explain:
  • New KendoUI application with globalization;
  • Add the fr-FR culture: 
<script src="@Url.Content("~/Scripts/kendo/2013.2.918/cultures/kendo.culture.fr-FR.min.js")"></script>

  • Set the kendo culture in the layout:
   <script type="text/javascript">
       kendo.culture("fr-FR")
   </script>


  • Creating in the Index.cshtml a DatePicker.
When running the app and select a date, the DatePicker displays (for example) 16.10.2013. This value cannot be validated, the system expects “16/10/2013”. The culture of the calendar is OK (french labels everywhere), but the value which is displayed has a wrong format. 

Otherwise, If I choose to set the culture of the DatePicker explicitly:

            @(Html.Kendo().DatePickerFor(m=>m.D)
                .Culture("fr-FR")
            )


Then everything works like a charm.

Did I missed something? 

Thank you,

Catalin




Catalin
Top achievements
Rank 1
Veteran
 answered on 24 Oct 2013
2 answers
382 views
Hi -

  I want to bind the invisible binding attribute to an expression.   I'm pretty sure expressions work in Knockout but they don't appear to work in kendos implementation of MVVM.

  <input  data-bind="value: addressLine3, invisible: addressCountry == 'USA' "/>

 The expression is pretty simple.

 Thanks,  
RDot
Top achievements
Rank 1
 answered on 24 Oct 2013
1 answer
95 views
Hi,
    When using the ActionSheet and kendo mobile 2013.2.918 the actionsheet does not resize it's self all the time. If I start in portrait mode and show the actionsheet it shows fine, then rotate to landscape and the actionsheet follows and show fine expand to the full width of screen, If I then rotate back to portrait  and cancel the actionsheet. Then rotate the device to landscape and open the actionsheet it shows centered rather full width of screen and if I then rotate back to portrait then it shows to the left and the modal mask does not cover the screen. I can replicate even when using the latest internal build 2013.2.1021.

I'm using this on iPhone and with Icenium and if you use the simulator it's even worse.

Is there a solution to this?

Thanks
Kiril Nikolov
Telerik team
 answered on 24 Oct 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?