Telerik Forums
Kendo UI for jQuery Forum
2 answers
237 views
I have a little snippit of code to create a kendo grid declaratively:

<div id="sitesGrid" data-role="grid" style="width: 800px;"
                 data-sortable="true"
                 data-columns='[{ "field": "accountName", "title": "Account", "width": "150px" }, 
                { "field": "subAccountName", "title": "Sub Account", "width": "180px" }, 
                { "field": "siteName", "title": "Site", "width": "150px" }, 
                {"field": "checkedout",  "title": "Check Out",  "width": "80px"}]'
                data-source="AuroraSurveyTool.lovs.siteList">
            </div>

I would like to have a CheckBox button in the 'Checkedout' field.   How do I do that?  I tried using a template but could not get it configured in any way that was acceptable.
Stanley
Top achievements
Rank 1
 answered on 28 Aug 2012
4 answers
908 views
Im having trouble with the combobox as a custom editor. Populating the values are fine, however when selected the entire object (from the combobox) of the row is put into the bound field. This displays itself as [object Object]
Ive copied the column from the demo http://demos.kendoui.com/web/grid/editing-custom.html as is acting the same strange way that my own field does.
[update solving problems while going along]

Ive had similar problems before but just changed how it was populated. This works fine:
var proxyDropDownEditor = function(container, options){
    var data = [
        { text: "none" },
        { text: "HTTP" },
        { text: "CONNECT"},
        { text: "best" }
    ];
    $('<input data-bind="value:' + options.field + '"/>')
        .appendTo(container)
        .kendoDropDownList({
            dataTextField: "text",
            dataValueField: "text",
            dataSource: data
        });   
};

This is the one I need working:
The editor of the cueCollection is:
function cueCollectionEditor(container, options){
    var dataSource = new kendo.data.DataSource({
        type: "json",
        transport: {
            read: "/OrchardLocal/Nyx/EditCueCollection/List?ContentId=29"
        },
        schema: {
            model: {
                id: "Id"
            }
        }
    });
    $('<input data-text-field="Name" data-value-field="Id" data-bind="value:' + options.field + '"/>')
        .appendTo(container)
        .kendoDropDownList({
            autoBind: false,
            dataSource: dataSource
    });
 
    //$('<input name="' + options.field + '"/>')
    //    .appendTo(container)
    //    .kendoDropDownList({
    //        autoBind: false,
    //        dataTextField: "id",
    //        dataValueField: "id",
    //        dataSource: options
    //});   
}

but it currently has two problems. Clicking on any item it will select correctly and display correctly (in edit row) until finishing with row and clicking update. The first time this it is done the row will display "[object Object]" with the save method showing me the values of the model:
Category
    Object { __metadata={...}, CategoryID=4, CategoryName="Dairy Products", more...}
cueCollection
    Object { Id=4, Name="Carousel 2"
dirty:
    false
proxyType:
    "best"
other fields are excluded as they are just general columns and are working as expected. Im expecting the category to be populated as "Dairy Products" and cueCollection to be "4".

These are the columns:
{ field: "cueCollection", title: "Cues", editor: cueCollectionEditor
    //template: kendo.template($("#cueCollectionColumnTemplate").html())
},
{ field: "Category", width: "150px", editor: categoryDropDownEditor },
{ field: "proxyType", title: "Proxy Type", editor: proxyDropDownEditor },
{ command: ["edit", "destroy"], title: " ", width: "210px" }

Schema
schema: {
    model: {
        id: "title",
        fields: {
            title: { type : "string", nullable: false },
            proxyType: { type: "string", defaultValue: "best" },
            position : { type: "number", defaultValue: 0 },
            cueCollection: { type: "number" },//changing the type to number removed the viewmodel from being returned 
            Category: { type: "string" }    //changing the type to string fixed it from being a object returned to the correct value
        }
    }
}
changing the field type of "Category" to a string seemed to have fixed its return value from the edit row. cueCollection was not so lucky.

the ajax response for the dropdown list is nothing too special:
[{"Id":2,"Name":"collection1"},{"Id":4,"Name":"collection2"}]

Overall my aim would be to add the entire json object into the column: {"Id":2,"Name":"collection1"}
as it would be easier to navigate and understand in its future context. Seeing that this is what it is giving me lets roll with it, although im expecting just the id field.

Back on track:
lets skip trying to get just the id, as the object looks far more exciting.
datasource - schema - model - cueCollection
lets give it a default so that creating a new row doesnt break so easily.
cueCollection: { defaultValue: { Id:0, Name: "" } },
combobox data result
[{"Id":2,"Name":"collection1"},{"Id":4,"Name":"collection2"}]

selecting the first item and clicking on the update row it will appear as undefined (one of the problems i had earlier but hadnt really noted).
selecting the second will populate cueCollection as expected (as observed). Clicking update will set the field as [object][object] so lets add a client template.
...
function templateCollection(mModel){
        if(!mModel)
            return "none selected";
        return mModel.Name;
    }
</script>   
<script id="cueCollectionColumnTemplate" type="text/x-kendo-tmpl">
    #: templateCollection(cueCollection) #
</script>
how the column looks in the grid definition:
{ field: "cueCollection", title: "Cues",
    editor: cueCollectionEditor,
    template: kendo.template($("#cueCollectionColumnTemplate").html())
},

current problems:
selecting the first item doesn't work. Lets try adding the option label to see if it is just that first field.
$('<input data-bind="value:' + options.field + '"/>')
    .appendTo(container)
    .kendoDropDownList({
        dataTextField: "Name",
        dataValueField: "Id",
        autoBind: false,
        dataSource: dataSource,
        optionLabel: "Select..."
});
... *scratches head* ... selecting any item is causing problems now. As it has now decided on binding the "Id" value and now losing the object. This is turning into one of those get what you want at the wrong time scenarios.

Interesting. Adding in the option-label fixed the data bind issue, but broke how I was now expecting it. So now I need the data row value instead of a data field value.

Ok now quite confused. It is now selecting the object again.
Ive changed the editor to:
var hiddenBox = $('<input type="hidden" data-bind="value:' + options.field + '"/>').appendTo(container);
var box = $('<input data-bind="value:' + options.field + '"/>')
    .appendTo(container);
 
var kendoDropDown = box.kendoDropDownList({
        dataTextField: "Name",
        dataValueField: "Id",
        autoBind: false,
        dataSource: dataSource,
        optionLabel: "Select..."
});

however the action of the dropdown has gone back to selecting the object over the Id

Can anyone describe what is going on with the dropdown. Static datasources seem to bind perfectly well, but ajax based data sources seem to be giving me the run around. It seems a little random now when it wants to select the Id or select the Object.

Any insight would be wonderful as I've spent far too long trying to get the dropdown to act consistently.

Thanks,
Matt
Matthew
Top achievements
Rank 1
 answered on 28 Aug 2012
1 answer
73 views
hello,
 who can tell me ,why the arrow just only one...please
Dimo
Telerik team
 answered on 28 Aug 2012
0 answers
124 views
When I preselect an item on the DropDownList using .search() method, the change event seems not to fire up after selecting first position. How can I fix that? 
Mikolaj
Top achievements
Rank 1
 asked on 28 Aug 2012
3 answers
239 views
I know this should be easy, but I'm having a hell of a time trying to get my remote data source working with templates. Can you give a quick example of how to bind a json datasource to a template (not inline)? Thanks!

I've tried all of the demos online, but none seem to work as I'd expect.
d2uX
Top achievements
Rank 1
 answered on 28 Aug 2012
0 answers
105 views
Hi kendo,

How to bind data  to grid control in server side . My application is not an MVC arch . We are using asp.net webforms .
I need to call WCF with input paramters .
 Samle code of calling service .
yantraClient.PoolSchedule(ref serviceIdentityContract, ref poolScheduleContract, out serviceErrorContract);


How to implement the above calling method .Please Reply ASAP.


Thanks,
Nawaz




Randhir
Top achievements
Rank 1
 asked on 28 Aug 2012
0 answers
156 views
Hi,

I am trying to keep the checkboxes from the grid using a temporary buffer in javaScript,  like the Rosen example in the link:

http://www.kendoui.com/forums/ui/grid/grid-editing-issue-with-template-columns.aspx

But I am using Kendo MVC UI, with HTML Helpers, instead of pure HTML.
The problem is that the data-uid changes each time I change from page 1 to page n, and later on come back to page 1.
The data-uid is changing each time I change the page and come back to the same page, is there a way to make it fix ?

Best Regards,
Tito Morais
Tito
Top achievements
Rank 1
 asked on 28 Aug 2012
1 answer
235 views
Hi

I have a simple razor page using the Listview

   @(Html.Kendo().ListView<MVCTicketSystem.ViewModels.TicketDetail>(Model)
          .Name("listView")
          .TagName("div")
          .ClientTemplateId("list-view-template")          
          .DataSource(dataSource => dataSource
                                        .Model(model => model.Id("TicketEntryId"))                                        
                                        .PageSize(5)                                        
                                        .Create(create => create.Action("TicketDetail_Create", "Ticket").Data("TicketInfo"))
                                        .Read(read => read.Action("TicketDetail_Read", "Ticket").Data("TicketInfo"))
                                        .Update(update => update.Action("TicketDetail_Update", "Ticket"))
                                        .Destroy(destroy => destroy.Action("TicketDetail_Destroy", "Ticket"))                                        
                                        .Sort(f=>f.Add(p=>p.DetailDate).Descending())                                                                                                        
          )
          .Pageable()          
          .Editable())

The Create method works but the object is partially populated at the server side and I need to visualize this data when the object is added to the list. So I need to either trigger a refresh of the current page or of the added object or something simular after the create.

I've searched the forum but can't find an answer to this problem which is strange as I guess everyone needs this kind of behavior.

best regards
Petur Subev
Telerik team
 answered on 28 Aug 2012
4 answers
2.1K+ views
Hi I've got a grid and one of the columns is bound ta boolean value. I would like to format it to something else other than true and false (On / Off for instance), and i realize I don't know how to do that. With a format field inside the columns property? How would such a format look like? Thanks in advance!
Iliana Dyankova
Telerik team
 answered on 28 Aug 2012
0 answers
80 views

@

 

using Kendo.Mvc.UI

 

@

 

using Kendo.Mvc.UI.Fluent

 

@

 

using SpineWMS.Domain

 

@model

 

IList<SpineMenu>

 

 

@(Html.Kendo().TreeView()

.Name(

 

"Outline")

 

.BindTo(Model, (

 

NavigationBindingFactory<TreeViewItem> mappings) =>

 

{

mappings.For<

 

SpineMenu>(binding => binding

 

.ItemDataBound((item, layer) =>

{

item.Text = layer.MenuText.ToString();

 

 

}

));

 

}

 

)

)

 
Why above code is giving error "Object reference not set to an instance of an object."

in _Layout.cshtml

 

<

 

 

li>@{this.Html.RenderPartial("~/Views/Menu/Index.cshtml");}</li>

 

Abdul Batin
Top achievements
Rank 1
 asked on 28 Aug 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?