Telerik Forums
Kendo UI for jQuery Forum
1 answer
575 views
Whenever I hit the "create" action on a Kendo Grid, it runs the same server side call for every item in the list that I created.

For example, I have three columns Increment/Range/SetId.

I add one item: 1/1/1
This calls my CreateItem method for the 1/1/1 item.

I add a second item: 2/2/1
This calls my Create Item method for the 1/1/1 item and the 2/2/1 item.

I now have items saved in my database as follows:
1/1/1
1/1/1 (Duplicate)
2/2/1

This pattern continues for as many items as I create. My Kendo code is as follows:

@(Html.Kendo().Grid<Model.IncrementSetItem>()    
            .Name("IncrementSetItemGrid")    
            .Columns(columns => {        
                columns.Bound(p => p.IncrementSetID);
                columns.Bound(p => p.Increment).Width(140);
                columns.Bound(p => p.RangeHigh).Width(140);
                columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200);
            })
            .ToolBar(toolbar => toolbar.Create())
            .Editable(editable => editable.Mode(GridEditMode.InLine))
            .Pageable()
            .Sortable()
            .Scrollable()
            .DataSource(dataSource => dataSource        
                .Ajax()                 
                .Events(events => events.Error("error_handler"))
                .Model(model => model.Id(p => p.ID))
                .Create(create => create.Action("CreateItem", "IncrementSet"))
                .Read(read => read.Action("GetIncrementSetItemsList", "IncrementSet"))
                .Update(update => update.Action("UpdateItem", "IncrementSet"))
                .Destroy(destroy => destroy.Action("EditingInline_Destroy", "Grid"))
            )
        )

Please let me know if there is a way to have the "Create" event only act on just the last item that I have created inline.
Alexander Valchev
Telerik team
 answered on 28 Sep 2012
3 answers
540 views
Does anybody know of a way to get the parent node of the node you currently have selected?
Iliana Dyankova
Telerik team
 answered on 28 Sep 2012
1 answer
142 views
I do not know as to copy following code from Kendo UI Fluent to write in JavaScript

Code Kendo UI Fluent

@(Html.Kendo().Chart() .Name("Chart") 
           .DataSource(ds => ds.Read(read => read.Action("ActionName", "ControllerName")
           .Data("filterFunction")))

Code JavaScript
jQuery(document).ready(function($)
{
$("#chart").kendoChart({
   dataSource: {
     transport: {
         read: "ControllerName/ActionName",
      parameterMap: filterFunction
}
},
David
Top achievements
Rank 1
 answered on 28 Sep 2012
1 answer
2.8K+ views
I create my drop down list like so

@(Html.Kendo().DropDownListFor(model => model.Project)
                    .Name("Project")
                                       .DataTextField("ProjectCode")
                                       .DataValueField("ProjectCode")
                                       .DataSource(source =>
                                       {
                                           source.Read(read =>
                                           {
                                               read.Action("GetProjects", "NewTimesheet");
                                           });
                                       })
                                               .Events(e => e.Select("projectChange"))
                                               .SelectedIndex(0)
            )


How do i refresh the data source from the server from a JavaScript event?

Thanks
sarat
Top achievements
Rank 1
 answered on 28 Sep 2012
1 answer
391 views
This code:
var MyModel = kendo.data.Model.extend();
var MyDataSource = kendo.data.DataSource.extend({
    options: {
        transport: {
            create: {
                url:
'dummy.json',
                type:
'GET',
                dataType:
'json'
            },
            read: {
                url:
'dummy.json',
                type:
'GET',
                dataType:
'json'
            },
            update: {
                url:
'dummy.json',
                type:
'GET',
                dataType:
'json'
            },
            destroy: {
                url:
'dummy.json',
                type:
'GET',
                dataType:
'json'
            }
        },
        schema: {
            model: MyModel,
            data:
'data',
            total:
'total'
        }
    }
});

var myDataSource = new MyDataSource();
var myModel = new MyModel({
    ding: 'dong',
    ping: 'pong'
});

myDataSource.add(myModel);
myDataSource.sync();

Creates this error message:
  1. Uncaught TypeError: Cannot call method 'push' of undefined kendo.web.js:6109
    1. Observable.extend._acceptkendo.web.js:6109
    2. Observable.extend.synckendo.web.js:6067
    3. f.Callbacks.njquery.min.js:2
    4. f.Callbacks.o.fireWithjquery.min.js:2
    5. f.Callbacks.o.firejquery.min.js:2
    6. Observable.extend._promise.$.Deferred.transport.(anonymous function).call.extend.successkendo.web.js:6175
    7. f.Callbacks.njquery.min.js:2
    8. f.Callbacks.o.fireWithjquery.min.js:2
    9. f.support.ajax.f.ajaxTransport.send.djquery.min.js:4

If schema.total is not defined everything works fine.
Unfortunately we need the total because we use a pageable Grid.

Any help or thoughts on that issue?

An example can be found here: http://dl.dropbox.com/u/105042779/kendo/datasource.html (Please look into the source code or console)
Rosen
Telerik team
 answered on 28 Sep 2012
12 answers
2.9K+ views
Hi

I have a grid that has a column that uses a DropDownList (see code below).  

columns: [
    { field: "Choices", title: "My Choices", width: "150px",
        editor: function(container, options) {
              $('<input data-text-field="Name" data-value-field="Value" data-bind="value:' + options.field + '"/>').appendTo(container).kendoDropDownList({
               dataSource: {
                     data: myChoicesArray
              },
              dataValueField: "Value",
              dataTextField: "Name",
              autobind: true
          });
      }
   },
   { command: ["edit", "destroy"], title: " ", width: "210px" }
],

I'm using kendoui.complete.2012.1.229.beta

I have 2 issues:

1. When the user clicks on 'Add new record' and edits ALL the fields, the binding is fine.  If the user wants to use the default value in the DropDownList (i.e. no onChange event), on clicking 'Update', the value from the DropDownList is not bound and the value in the column remains blank.  This happens if I set the editing mode to 'inline' or 'popup'.  How do I get it to bind the default value?

2. I'm using a MVVM viewModel to store the details in the grid which will be sent to the server in a subsequent step.  If I set data-value-field="Value", I get the value (incorrectly) appearing in the grid and the viewModel correctly gets the value.  On the otherhand, if I set data-value-field="Name", I get the text correctly appearing in the grid but then the viewModel incorrectly gets the text too.  I would like to have the text of the DropDownList choice appear in grid and the value of the choice stored in the viewModel.  How can I do this?

Thanks
Rosen
Telerik team
 answered on 28 Sep 2012
7 answers
589 views
Hi
 I want to display specific month (not current month) on load of kendo calendar, Any Suggestion
Kula
Top achievements
Rank 1
 answered on 28 Sep 2012
2 answers
254 views
I am binding tree view to a model. I want to add 'static' parent node. Is it possible? Here is code I am using now. 

<%
= Html.Telerik().TreeView()
           
.Name("TreeView")
           
.BindTo(Model, mappings =>
           
{
                mappings
.For<Employees>(binding => binding
                       
.ItemDataBound((item, emp) =>
                       
{
                            item
.Text = emp.EmpName;
                       
}));                    
           
})            
%>
Devon
Top achievements
Rank 1
 answered on 27 Sep 2012
0 answers
81 views
hi there, i want to change the <td> width inside the grid view.
some <td> i want it with 310 px, for instance , the first td. the second td i want it with 290 px
I try to do it over <td width = "310px"> or external css , none of them works.

maybe i just not using the right syntax.

plz help.

my code 

<div id="example" class="k-content">
 
 
<table id="grid" style="float: left; position: relative">
    <thead>
        <tr>
            <th width ="310px"data-field="FileName">File Name
            </th>
            <th  width ="290px"data-field="ID">File Identifier
            </th>
 
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {
            <tr >
                <td  class="idRank" >
                    @item.FileName
                </td>
                <td  class="idRank2"  >
                    @item.ID
                </td>
 
            </tr>
        }
    </tbody>

it works for <th>, i want the <td> match with <th>
Edward
Top achievements
Rank 1
 asked on 27 Sep 2012
0 answers
195 views
Hello,

I have a grid that's being bound to a datatable and works fine with server requests. But once I try binding via ajax I get a circular reference error. I tried to use a helper method to convert the datatable into List<Dictionary<string, object>> and bind the grid to said collection, but I can't get that to work either.
My need to use a DataTable stems from a particular use case, let me illustrate:
The application enlists certain areas within a manufacturing process, each area has a list of part numbers/names; in a different form defects are being captured for particular parts. The grid must be rendered "dynamically" based on the part names listed for a particular area in the database, and the amount of defects for each part, like so:

Column 0 Column 1 Column 2 Column 3 Column 4
Defect Silicone seal FF Mask Headgear Swivel
Bubbles in functional area 0 0 0 3
Heterogeneous coloring 4 0 1 0
... ... ... ... ...

Column0 is fixed and must happen for all instances of the grid, the number of columns after this one depends on what I mentioned above, so the overall number of columns and member name/title will vary.
My first approach was to build a DataTable from the information retrieved from database, which works fine with server binding, but I'm stumped as to how to use ajax binding (which is needed for requirements not listed here). I've attached a sample project with my approach. Any suggestions?
Josias
Top achievements
Rank 1
 asked on 27 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
Licensing
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
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?