Telerik Forums
Kendo UI for jQuery Forum
1 answer
107 views
How I can use the filter in Ajax??, If you use this as an error*:

Expected primaryExpression

*Sorry for English
@(Html.Kendo()
      .Grid<Partial.Model>()
      .Name("Grid")
           .Columns(columns =>
      {
          columns.Bound(p => p.Id).Hidden(true).ClientTemplate("<span id=\"Id\">#: Id #</span>");
          columns.Bound(p => p.Names);
          columns.Bound(p => p.Another);
      })
       .Sortable()
      .Filterable()
      .DataSource(dataSource => dataSource
                                          .Ajax()
                                          .Read(read => read.Action("Action", "Controller")).Filter(r=>r.Add(a=>a.Id==1)))
 
)
Renier
Top achievements
Rank 1
 answered on 11 Aug 2012
0 answers
129 views
By adding the name value to the input of the this combobox means that it now gets submitted when the form is submitted, this now breaks all my data saves as they validate incomming data against the my model and obviously the input names (elemntName_input) which is now part of kenod, is not part of my model.

is there an option to change turn this off? 
Andre
Top achievements
Rank 1
 asked on 11 Aug 2012
0 answers
179 views
VIEW
.DataSource(dataSource => dataSource
    .Server()
    .Model(model => model.Id(p => p.id))
    .Destroy(excluir => excluir.Action("ExcluirOnOff","Home"))
)


CONTROLLER

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult ExcluirOnOff(int OnOffID)
{
    moneymanagerBDEntities _db = new moneymanagerBDEntities();
    var product = _db.tbl_001.FirstOrDefault(p => p.id == OnOffID);
 
 
    var routeValues = this.GridRouteValues();
     
    if (product != null)
    {
        return RedirectToAction("Index", routeValues);
    }
    return RedirectToAction("Index", routeValues);
}


HELP !
Gilberto
Top achievements
Rank 1
 asked on 11 Aug 2012
0 answers
122 views

I am pretty New to Javascript and jQuery.


I am now just learning to build User Interface and was checking out KendoUI. I must say its amazing. 


I want to have data in a local file on my computer. Access the data and show it in grid/table.


I want to be able to edit and save the data back to the local file using the user interface in the browser.


I am looking at : http://demos.kendoui.com/web/grid/editing.html


Looking at the source, the data is obtained/saved from/to a remote server:


<script>
            $(document).ready(function () {
                var crudServiceBaseUrl = "http://demos.kendoui.com/service",
                    dataSource = new kendo.data.DataSource({
                        transport: {
                            read:  {
                                url: crudServiceBaseUrl + "/Products",
                                dataType: "jsonp"
                            },
                            update: {
                                url: crudServiceBaseUrl + "/Products/Update",
                                dataType: "jsonp"
                            },
                            destroy: {
                                url: crudServiceBaseUrl + "/Products/Destroy",
                                dataType: "jsonp"
                            },
                            create: {
                                url: crudServiceBaseUrl + "/Products/Create",
                                dataType: "jsonp"
                            },
                            parameterMap: function(options, operation) {
                                if (operation !== "read" && options.models) {
                                    return {models: kendo.stringify(options.models)};
                                }
                            }
                        },
                        batch: true,
                        pageSize: 30,
                        schema: {
                            model: {
                                id: "ProductID",
                                fields: {
                                    ProductID: { editable: false, nullable: true },
                                    ProductName: { validation: { required: true } },
                                    UnitPrice: { type: "number", validation: { required: true, min: 1} },
                                    Discontinued: { type: "boolean" },
                                    UnitsInStock: { type: "number", validation: { min: 0, required: true } }
                                }
                            }
                        }
                    });
 
 
                $("#grid").kendoGrid({
                    dataSource: dataSource,
                    navigatable: true,
                    pageable: true,
                    height: 400,
                    toolbar: ["create", "save", "cancel"],
                    columns: [
                        "ProductName",
                        { field: "UnitPrice", title: "Unit Price", format: "{0:c}", width: 150 },
                        { field: "UnitsInStock", title: "Units In Stock", width: 150 },
                        { field: "Discontinued", width: 100 },
                        { command: "destroy", title: " ", width: 110 }],
                    editable: true
                });
            });
        </script>


How can I possibly have this jSON file on my computer and edit/save the data on it.


Any help with a working example shall be hight appreciated.


Thanks,


Praney 

Praney Behl
Top achievements
Rank 1
 asked on 11 Aug 2012
0 answers
199 views

I am pretty New to Javascript and jQuery.


I am now just learning to build User Interface and was checking out KendoUI. I must say its amazing. 


I want to have data in a local file on my computer. Access the data and show it in grid/table.


I want to be able to edit and save the data back to the local file using the user interface in the browser.


I am looking at : http://demos.kendoui.com/web/grid/editing.html


Looking at the source, the data is obtained/saved from/to a remote server:


<script>
            $(document).ready(function () {
                var crudServiceBaseUrl = "http://demos.kendoui.com/service",
                    dataSource = new kendo.data.DataSource({
                        transport: {
                            read:  {
                                url: crudServiceBaseUrl + "/Products",
                                dataType: "jsonp"
                            },
                            update: {
                                url: crudServiceBaseUrl + "/Products/Update",
                                dataType: "jsonp"
                            },
                            destroy: {
                                url: crudServiceBaseUrl + "/Products/Destroy",
                                dataType: "jsonp"
                            },
                            create: {
                                url: crudServiceBaseUrl + "/Products/Create",
                                dataType: "jsonp"
                            },
                            parameterMap: function(options, operation) {
                                if (operation !== "read" && options.models) {
                                    return {models: kendo.stringify(options.models)};
                                }
                            }
                        },
                        batch: true,
                        pageSize: 30,
                        schema: {
                            model: {
                                id: "ProductID",
                                fields: {
                                    ProductID: { editable: false, nullable: true },
                                    ProductName: { validation: { required: true } },
                                    UnitPrice: { type: "number", validation: { required: true, min: 1} },
                                    Discontinued: { type: "boolean" },
                                    UnitsInStock: { type: "number", validation: { min: 0, required: true } }
                                }
                            }
                        }
                    });
 
 
                $("#grid").kendoGrid({
                    dataSource: dataSource,
                    navigatable: true,
                    pageable: true,
                    height: 400,
                    toolbar: ["create", "save", "cancel"],
                    columns: [
                        "ProductName",
                        { field: "UnitPrice", title: "Unit Price", format: "{0:c}", width: 150 },
                        { field: "UnitsInStock", title: "Units In Stock", width: 150 },
                        { field: "Discontinued", width: 100 },
                        { command: "destroy", title: " ", width: 110 }],
                    editable: true
                });
            });
        </script>


How can I possibly have this jSON file on my computer and edit/save the data on it.


Any help with a working example shall be hight appreciated.


Thanks,


Praney 

Praney Behl
Top achievements
Rank 1
 asked on 11 Aug 2012
1 answer
948 views
I'm trying to open a window where content page has uses a template to display the data.
The content page it self works fine just entering the url but when I try to open it as a window nothing happens.
     var window = $("#window");
    
   window.kendoWindow({
        width: "505px",
        height: "315px",
        title: "Mail",
        actions: ["Refresh", "Maximize", "Close"],
        content:"inbox/getemail.aspx?msgid="+msgid,
        iframe:false
    });
 
    window.data("kendoWindow").open();

//content page 
script language="javascript">
 
var messageData;
 
$.fn.getMessageData = function(){
     
    messageData =
    {      
        time:'2012-07-26 12:34:50',
        sender:'test@test.com',
        subject:'Testing message data'     
    };
};
 
$(function(){  
    var template = kendo.template($("#template").html());
    $.fn.getMessageData();     
    $("#preview").html(template(messageData));
        
});
 
</script>
 
<script type="text/x-kendo-template" id="template">
    <h3>#= subject #</h3>
    <h4>posted on #= time # by <strong>#= sender #</strong></h4
</script>
 
 <div id="preview"></div>
John DeVight
Top achievements
Rank 1
 answered on 10 Aug 2012
0 answers
451 views
Hi folks,

I'm using a treeview from a HierarchicalDataSource and wanted to be able to get the element from the treeview if it matched all the properties that I specified. My initial data looked something like this:

[{
    id:'2022',
    text:'Folder1',
    items: [{
        id:'3202',
        text:'Sub-Folder1'
    }, {
        id:'1234',
        text:'Sub-Folder2',
        moo: true
    }]
}]

I wanted to be able to get the list item element (<li>) for any particular item so I built a function to do it and thought I'd share. You can use my function like this (in this example I want to get the element for the item with the id '3202':

var liElement = $('#treeView').data('kendoTreeView').search({id:'3202'});

You can also search on multiple properties:

var liElement = $('#treeView').data('kendoTreeView').search({id:'1234', moo: true});

To enable this functionality, after creating a treeview with a HierarchicalDataSource, add this code (assumes your treeview element is #treeView - change as required):

$("#scenegraph-treeview").data('kendoTreeView').search = function (json, source) {
    if (json !== undefined) {
        var data = source || this.dataSource,
            child, item, i, k, match, allMatched;
 
        // If the data has the properties we need
        if (data && data._data) {
            child = data._data;
 
            // If the array has items
            if (child.length) {
                // Loop the array items
                for (i = 0; i < child.length; i++) {
                    item = child[i];
 
                    console.log('Checking child ' + i + ' id ' + item.id);
 
                    // Check each json property against the current item's properties
                    // and if they all match, grab the tree item based on it's UID
                    allMatched = true;
                    for (k in json) {
                        if (json.hasOwnProperty(k)) {
                            if (item[k] !== json[k]) {
                                // The item doesn't have all the properties
                                // that the json object does
                                allMatched = false;
                                break;
                            }
                        }
                    }
 
                    if (allMatched) {
                        // We've found a match, grab the tree item from the UID and return it
                        return this.findByUid(item.uid);
                    } else {
                        // We didn't find what we were looking for so search the children
                        if (item.children) {
                            match = this.search(json, item.children);
                            if (match) {
                                return match;
                            }
                        }
                    }
                }
            }
        }
    }
};

Hope this helps someone out!

Rob - Irrelon Software Limited
Rob
Top achievements
Rank 1
 asked on 10 Aug 2012
0 answers
128 views
Hi, the whole form was working properly before, and after I decorated some input fields of the form with kendo, in the action, I var_dump the form, those kendo inputs are missing and everything else is all good.

Any idea guys ? Please help me to save my hair, cheers.

I also checked with other UI plugins, it's all good.

Is this cause by the version I chose, open oource one ?
KJ
Top achievements
Rank 1
 asked on 10 Aug 2012
2 answers
191 views
I'm in the midst of writing a single page application with routes.  The way the application functions is:
  1. DataSource with list of items is bound to a Kendo Grid
  2. User clicks an item on the Grid and is taken to a new route which contains the ID of the item the user selected.  Example: www.mydomain.com/#itemID=1
  3. This ID is used in a DataSource to refresh the item the user chose.  This is also done in case the user bookmarks the specific route.  In such an event the Grid can be bypassed.
The binding of the Grid works great and I'm able to capture the ID of the chosen item and redirect to my new route.  I'm also able to create a new datasource with the ID of the item selected and return data from the server.

Here's where I'm stuck.  I'm trying to bind the returned record to HTML controls using an MVVM pattern, but it seems the Kendo binding context assumes that DataSource is a collection (where in my case it's a single record).  What is the correct approach for this?  Is there a way to bind controls in a DIV to a single record in a DataSource?
Jeff
Top achievements
Rank 1
 answered on 10 Aug 2012
2 answers
297 views
I am trying to implement a MVVM pattern for my website's login function.

The site returns with status code 401 when authentication fails.  The goal would be to:
  1. Update my view model to indicate that the user is not authenticated.  Example: viewModel.set("authenticated", false)
  2. When authenticated is false, display a Kendo window with the username/password prompt
  3. Then the user presses submit within this window, fire my login method
Everything works except I am having the following problems:
  1. I can't find a way to bind the open/close state of the Kendo window (my login window) to the authenticated property of my viewModel
  2. When I bind to the input of type password, it seems to be one-way.  I am able to get the password the user typed in and pass this up to my web method, but during the login function I clear the password viewModel.set("password", "") but the input control does not update.  If I change it to a regular input with type text it seems to work.
Jeff
Top achievements
Rank 1
 answered on 10 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
Drag and Drop
Application
Map
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
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?