Telerik Forums
Kendo UI for jQuery Forum
0 answers
261 views
How do i post a dynamic url to a method when using kendo grid with ajax bindings?

@(Html.Kendo().Grid(Model)
    .Name("Grid")
 
    .Columns(columns =>
    {

        columns.Bound(p => p.SalonName).Groupable(false);
        columns.Bound(p => p.ServiceName);
        columns.Bound(p => p.ResourceName);
        columns.Bound(p => p.StartDate).Format("{0: yyyy-MM-dd}").Title("Datum");
        columns.Bound(p => p.StartDate).Format("{0:hh:mm}").Title("Tid");
        columns.Bound(p => p.Duration);
        columns.Command(command => command.Custom("Detaljer").Click("BookingDetails"));
        columns.Command(command => command.Custom("Avboka").Click("confirmBookingRemoval"));
    })
     
    .Pageable()
    .Sortable()
    .Scrollable()
    .Selectable()
    .DataSource(dataSource => dataSource
        .Ajax()
                .Read(read => read.Action("ReadBookings", "Kund"))
                .ServerOperation(true)
                .PageSize(25))
                .Events(events => events.Change("grid_selected"))
)

<script type="text/javascript">
    function BookingDetails(arg) {
        var grid = $('#Grid').data('kendoGrid');
        var dataItem = this.dataItem($(arg.currentTarget).closest("tr"));
        var id = dataItem.AppointmentID;
        window.location.href = "@Url.Action("Detaljer", "@User.SalonKey/Boka")" + "/" + id;
        };
</script>
Stefan
Top achievements
Rank 2
 asked on 25 Sep 2012
1 answer
202 views
Hi,
Depending on an action that the user may make on a page, I want to set the column visibility without having to re-read the grid source or post back the page.  Is this possible?  I am using ajax binding if that matters.

Thanks,
David A.
Rosen
Telerik team
 answered on 25 Sep 2012
0 answers
103 views
Hi all,

My question is around passing query string parameter to another page.(From Default.htm  to EmptyView.htm)

As you know when you navigate url looks like: http://localhost/views/Default.htm#EmptyView.htm?id=1 and browser doesn't render this url.

Any suggestions? How can I pass parameter in such situation.

Cheers.
Tronur
Top achievements
Rank 1
 asked on 25 Sep 2012
0 answers
267 views
HI,
I made an interface with some controls, from Kendo. It's a number, textbox and dropdownlist. What it does it's create many copies of itself by the press of the "+" button and delete a row by the press of it's "-" button.

Here's the code:
{% extends "saloons/templates/base.html" %}
{% from "ui/forms/macro.html" import wtform %}
{% block content %}
  <form method="POST" action="">
    <table>
        <tr>
            <td>{{ form.order_date.label }}</td>
            <td>{{ form.order_date }}</td>
        </tr>
    </table>
  <div id="grid-users"  class="grid-content" style="text-align: center; width: 100%!important">
      <table id="grid">
    <thead>
      <tr>
        <th data-field="number" style="text-align: center">Nro.</th>
        <th data-field="item" style="text-align: center">Articulo</th>
        <th data-field="staff" style="text-align: center">Usuario</th>
        <th data-field="button" style="text-align: center">Añadir/Remover</th>
      </tr>
    </thead>
    <tbody id="pedidos">
      <tr>
        <td>1.</td>
        <td>{{ form.item }}</td>
        <td>{{ form.staff }}</td>
        <td><button type="button" id="add_textbox">+</button></td>
      </tr>
    </tbody>
      </table>
      <center>
     <div class="buttons">{{ form.save }}</div>
      </center>
  </div>
  </form>
<script type="text/javascript">
    $(function() {
        $("#save").attr('class','k-button');
        $("#c0").attr('class', 'k-input');
        var sel = $("#t0").clone();
        var sel2 = $("#c0").clone();
        var i = 1;
        var data = "{{ inventory }}".replace("[", "").replace("]", "");
                var a = data.split(",");
                for(j=0;j<a.length;j++)
                {
                  if(j == 0){
                   a[j] = a[j].substring(2,a[j].length -1);
                  }
                  else
                  {
                    a[j] = a[j].substring(3,a[j].length -1);
                  }
                }
        $("#add_textbox").attr('class', 'k-button');
        $("#add_textbox").live('click', function() {               
            i++;
            $("#pedidos").append('<tr>' +
                        '<td>'+ i +'. </td>' +
            '<td id="c'+ i +'"></td>' +
            '<td id="t'+ i +'"></td>' +
            '<td><button type="button" rel="del" class="k-button">-</button></td>' +
            '</tr>');
            $(sel2).attr('id',"tc"+i);
            $(sel).attr('id',"ts"+i);
            $(sel2).appendTo("#c"+i);
            $(sel).appendTo("#t"+i);
            $("#tc"+i).css('width', 180);
            $("#tc"+i).kendoAutoComplete({
                   dataSource: a
                        });
            sel = $(sel).clone();
            sel2 = $(sel2).clone();
            $("#ts"+i).css('width', 270);
            $("#ts"+i).kendoDropDownList();
        });
                 
                $("button[rel=del]").live('click', function() {
                   $(this).parent().parent().remove();
                   i--;
                    
                   var a2 = 0;
                   $("#pedidos tr").each(function(i){
                      a2++;
                      $(this).find("td:first").html(a2);                     
                   });                  
        });
                 
                 
     
        $("#order_date").kendoDatePicker({
             min: new Date(),
             value: new Date(),
                     format: "dd/MM/yyyy"
          });
        $("#order_date").attr('disabled','disabled');
         
        $("#grid").kendoGrid({
          height: 460,
          sortable: false,
          columns: [{field:"number", width:40},
                {field:"item", width:40},
                {field:"staff", width:80, editor: function(container, options){
                  }},
                {field:"button", width:40}]
 
          });
        $("#t0").css('width', 270);
        $("#t0").kendoDropDownList();
         
        $("#c0").css('width', 180);
        $("#c0").kendoAutoComplete({
                    dataSource: a
                });
        });
</script>
{% endblock %}

Happens that at some point when you start deleting rows, some dropdowns and textboxes are assigned to the wrong rows. At first I thought that it was because some ids didn't match when making the recount in the minus button, but I already tried that.

Can you help on this one, please?
Christian
Top achievements
Rank 1
 asked on 25 Sep 2012
4 answers
355 views
I am attempting to load a grid into the content of the first tab in a tabstrip.  I have tried several variations of the code and how the grid loads, including via the "activate" event.  Here is a jsfiddle of a basic version of the code.  The grid works with the tabstrip code commented out.  It seems like it would be a simple oversight.
Aparna
Top achievements
Rank 1
 answered on 24 Sep 2012
6 answers
414 views
I have a menu inside a splitter and when it expands, it expands outside the spitter, and the splitter needs to be resized to see the menu items.

Is it possible to change the order of a menu so the overflow is not hidden and it expands over the spitter?

This post: http://www.kendoui.com/forums/ui/menu/menu-z-index.aspx and http://www.kendoui.com/forums/ui/menu/menu-splitter-hides-the-pop-ups.aspx don't work. All this does is cause scrollbars to show on the splitter pane containing the menu, it doesn't actually make the menu items expand over the top of the splitter.
Audrey
Top achievements
Rank 1
 answered on 24 Sep 2012
2 answers
171 views
Hi,

1. From a webpage lets say(a.aspx), I have opened a kendo window(which is again a web page say b.aspx)
2. I have a close button inside b.aspx .
3. now once i click on the close button , the keno window should be closed.


Any suggestions.
Thanks in advance
Michael
Top achievements
Rank 1
 answered on 24 Sep 2012
0 answers
132 views
The Grid:
$('#' + idGrid).kendoGrid({
  dataSource: dataSource,
  height: 400,
  toolbar: [{name: "create", text:"Create County"}],
 columns: [
      { field:"_id", title: "ID", width: "50px" },
      { field: "_status", values: status, title:"Status", width: "100px", editor: status_dropdown },
      { field: "_country_id", title: "Country", values: countries, width: "50px", editor: country_dropdown },
      { field: "_county_id", title: "County", values: counties, width: "50px", editor: county_dropdown },
      { field: "code", title: "Code", width: "150px" },
      { field: "name", title: "Name", width: "150px"},
      { field: "localname", title: "Localname", width: "150px"},
      { command: ["edit", "destroy"], title: " ", width: "200px" }],
      editable: "popup",
      sortable: {
       mode: "multiple",
       allowUnsort: true
      },
      filterable: true,
      resizable: true,
      groupable: true,
      pageable: {
    pageSize: 30,
    refresh: true
      }
});

the fields "_status", "_country_id", "_county_id" have integer values in database, but we want to show string values to the user. So we use the "values" parameter that is an array. In the case of _status for example we use:

var status = [{
  "value": 0,
  "text": "Disabled"
  }, {
  "value": 1,
  "text": "Enabled"
}];

Everything works fine...

The other two, however are arrays that are created from datasources that are populated from the server. That means the action is asynchronous. So if you try creating datasource->array->grid asynchronously the array might not be populated so the grid shows integer values instead.

If i have one such datasource i use the "change" event of the datasource to create the array and then the grid. For example:
var countiesData;
     var counties = new Array();
     var countiesDataSource = new kendo.data.DataSource({
       transport: {
         read: {
           url: "../order_new/county.php"
         }
       },
        schema: {
           data: "data"
         },
         change: function(e) {
                  countiesData = this.data();
                  console.log(countiesData);
                  var counties = new Array();
                  for (var i = 0; i < countiesData.length; i++) {
                    var dataItem = countiesData[i];
     
                    counties.push({
                      "value": parseInt(dataItem._id),
                      "text": dataItem.name
                    });
                  }
                 //here goes the previous code of grid creation
}

This works just fine... But what should i do now that i have two (or maybe more) foreign keys that need integer->string modification?
Just to know, i have tried creating the second datasource inside the change event of the first and then creating the grid inside the change event of the second. Doesn't work! And is far from elegant solution. Any ideas telerik team and users?
Fedon
Top achievements
Rank 1
 asked on 24 Sep 2012
0 answers
60 views
Hello, I need a way to find out how much space the tree view takes after it finish rending, is there such event that I can hook to calculate the height.
Jianwei
Top achievements
Rank 1
 asked on 24 Sep 2012
1 answer
126 views
I have a grid dynamically configured to fill the available space on the screen, and resize as necessary.  How would I go about getting the pagesize to set based on the calculated height of the grid?
Brad
Top achievements
Rank 1
 answered on 24 Sep 2012
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
Application
Map
Drag and Drop
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
ListBox
DropDownTree
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
PivotGridV2
ScrollView
Switch
TextArea
BulletChart
Licensing
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
FloatingActionButton
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
TimePicker
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
SegmentedControl
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?