Telerik Forums
Kendo UI for jQuery Forum
1 answer
184 views
Hello,

I have added an example of the problem, see:
http://jsbin.com/edamuj/427/edit

I have an editable grid and want to connect it with an editable datasource. This works if I create the grid with the datasouce available. However in my solution I am not sure when the js for the datasource is rendered but if it is rendered I register it in a kendo observable array. A function to set the the grids datasource is bound the change event of the observable array. After this function fires I would like the grid to show the data. Unfortunately this is not working. I simplified the problem and added it as an example. Can someone explain to me what I am doing wrong here?

Marcel
Rosen
Telerik team
 answered on 15 Feb 2013
1 answer
121 views
Hello, I need to fill TreeView Object from asmx webservice.
The data must be:
Main
    DepA
         A
             A1
    DepB
        B
          B1
..............................................................
I don't need to get all data for tree creation for the first time.
I need append the nodes, from the webservice and 'refresh' the tree
The node must include the ID & Name.
How I must organize the WebServise? What format of data must be returned?
How I could append new node and recreate tree?
Petur Subev
Telerik team
 answered on 15 Feb 2013
1 answer
231 views
I have a grid where the columns are dynamic.  By default (no schema set) all the columns are strings which causes the sorting to not be that helpful.

I use a web service that returns json to get the data for the grid, can I define the column types there or would that be a separate call?

Once I know the column types is it possible to set the column format based on the type? 

I have some code that defines the field type for columns if I know their exact name but that isn't very practical because there are many different possible column names.
schema: {
    model: {
        fields: {
            ReportDate: {
                type: "date"
            },
            Age: {
                type: "number"
            }
        }
    }
}
I also have some code that sets the template or format for a given column but it is also hard coded and not scalable.
//make first column a link using values from two columns
columns[0].template = "<a href='somepage.html?rid=#=ReportID#' target='_blank'>#=ReportNum#</a>";
 
//make sure value in 3rd column is formatted as a date
columns[2].format = "{0:M/d/yyyy h:mm tt}";
Any help would be appreciated. 
Alexander Valchev
Telerik team
 answered on 15 Feb 2013
1 answer
143 views
I am using the Kendo grid in remote virtualization mode for a very large data set. My stored procedures are aware of paging and capable of returning partial data fetches, instead of returning all rows for every request. Each service call will return exactly one page worth of data (100 records) based on my start/end markers. I use the request object to calculate the appropriate offsets for the next pull.

There are several 1000 records in my total record set, so I would like to avoid pulling all the data for every request.

However, for some reason I am not able to use ToDataSourceResult to build the JSON object that the grid expects to be passed back from my virtualization action:

EX:
public ActionResult Virtualization_GetProducts([DataSourceRequest] DataSourceRequest request, int productId)
        {
   int startIndex = (request.Page - 1) * request.PageSize + 1;
            int endIndex = startIndex + request.PageSize - 1;
            var result = service.GetProducts(productId,startIndex,endIndex);

            return Json(result.ToDataSourceResult(request));
        }

The result that I get is {"Data":[],"Total":100,"AggregateResults":null,"Errors":null} -- even though I get back the expected result from the service.

If I instead return all the data without using startIndex/endIndex the grid is able generate the correct JSON.

All the examples I've found (including your demo) involve pulling all the data in your data source every time. Is there a way to make this work with a data source that supports its own paging like above?
Rosen
Telerik team
 answered on 15 Feb 2013
2 answers
235 views
Hi there,

slowly getting used to this MVVM thing but I still have some problems.

I set up my viewmodel as a kendo.observable and also set a datasource and a method:
var orderViewModel = kendo.observable({
    orderList: orderDS,
    showOrderDetail: function(e) {
        var view = e.view;
     
        orderDS.fetch(function() {
            var model = view.model,
                item = orderDS.get(view.params.id);
            model.set("order", item)
        });
    }
});

My orders (the list) is displayed without any problem (tho it took me some time to accomplish that) 
Now I'm trying to display the corresponding details for each order in my detailsView:
<div
    id="orderDetail"
    data-role="view"
    data-layout="mobile-tabstrip"
    data-title="Orders"
    data-model="orderViewModel"
    data-show="showOrderDetail"
>
    <p data-bind="text: order.total"></p>
</div>

Nothing happens...
When I am moving the showOrderDetail out of my viewmodel (as function showOrderModel(e){ ...} everything works.
But I want to capsule the corresponding functions of a model (which is showing details) into that model. Or am I missing sth?

Hope someone can point me into the right direction.
Thx
Petyo
Telerik team
 answered on 15 Feb 2013
1 answer
105 views
I have two views that use the same data for different purposes (only showing the one with a problem below, they are basically the same thing). They each have a button group at the top and bottom of the list.  The problem I have is when I scroll to the bottom of one of my groups such as the A-E group, then click one of the button group buttons to load another set, it can be quite a bit shorter and nothing shows in the view.  I have to "double-click/drag" on the surface to get it to "come down" and show the list.  So I have been trying to get the scroller reset to work.  Scroller reset works fine in other areas of my app where the data-show function has access to the view.  But the data-select from the button group does not seem to pass the view to the function.  At least that is what I see from your sample code for button groups and data-select.  So when I try to get the view in the function from data-select, it works for one of the views but not for the other.  The one that does not work executes a data-show function from a different view, or rather it does the scroll work, but then also calls this unrelated function which renders a different view for another part of the app.  The extra function it calls is mobileCompanyPackageDataBind which is for the view in the code below the one I am working with.  If I use the Back button it shows the correctly scrolled alpha group I wanted, but there has got to be something wrong that it does this extra thing.  What is going on and can I work around it?


<div id="servicerLeadFlow" data-role="view" data-title="Adjust Lead Flow" data-show="mobileLeadFlowDataBind" style="display:none">
    <ul id="leadFlowBtnGroup1" data-role="buttongroup" data-index="0" data-select="servicerLoadGroup">
        <li>A-E</li>
        <li>F-J</li>
        <li>K-O</li>
        <li>P-T</li>
        <li>U-Z</li>
    </ul>
    <ul data-role="listview" data-style="inset">
        <ul id="servicerLeadFlowView"></ul>  
    </ul>
    <ul id="leadFlowBtnGroup2" data-role="buttongroup" data-index="0" data-select="servicerLoadGroup">
        <li>A-E</li>
        <li>F-J</li>
        <li>K-O</li>
        <li>P-T</li>
        <li>U-Z</li>
    </ul>
</div>
<div id="listCompanyPackages" data-role="view" data-title="Company Packages" data-show="mobileCompanyPackageDataBind" style="display:none">
    <div id="divShowCompany2"></div>
    <ul data-role="listview" data-style="inset">
        <ul id="companyPackageView"></ul>  
    </ul>
</div>
 
 
function servicerLoadGroup() {
    servicerGroup = this.current().index();
    var view;
    if (sevicerViewShown) {
        view = $("#servicerOnOff").data("kendoMobileView");
        setServicerGroupIndex();
    }
    if (leadFlowViewShown) {
        view = $("#servicerLeadFlow").data("kendoMobileView");
        setLeadFlowGroupIndex();
    }
    var scroller = view.scroller;
    scroller.reset();
    dsCompany.read();
}

EDIT:
I figured out a work around.  I save the appropriate view similar to above but do the scroller and scroller.reset in the change event of the datasource.  That seems to consistently work.

Petyo
Telerik team
 answered on 15 Feb 2013
0 answers
168 views
how to get the device ip address using cordova or jquery mobile
i tried the following example but does not work

http://simonmacdonald.blogspot.com/2012/08/so-you-wanna-write-phonegap-200-android.html
M Kumar
Top achievements
Rank 1
Iron
Iron
Veteran
 asked on 15 Feb 2013
1 answer
339 views
Hi, I am having problems using an instance of a kendo.Data.Model in a HierarchicalDataSource.

I tried this simple model for a folder object:

var folderModel = kendo.data.Model.define({
    id: "Id",
    hasChildren: "HasChildren",
    children: "Children",
    fields: {
        Id: { editable: false, nullable: true },
        Name: { validation: { required: true} },
        ParentFolderId: { editable: false, nullable: true }
    }
});

Then created a simple data source using that as the model:

var folderStore = new kendo.data.HierarchicalDataSource({
    transport: {
        read: {
            url: "/Folders/",
            dataType: "json",
            type: "POST"
        },
    },
    schema: {
        model: folderModel
    }
});

The datasource is then used to bind a TreeView.

$(function () {
    $("#folderTreeView").kendoTreeView({
        dataSource: folderStore,
        dataTextField: ["Name"]
    });
});

This fails and the treeview is not bound.

However, it does work if I use an inline approach when defining the datasource:

var folderStore = new kendo.data.HierarchicalDataSource({
    transport: {
        read: {
            url: "/Folders/",
            dataType: "json",
            type: "POST"
        },
    },
    schema: {
        model: {
            id: "Id",
            children: "Children",
            hasChildren: "HasChildren"
        }
    }
});

Even if I simplify the model down to:

var folderModel = kendo.data.Model.define({
    id: "Id",
    children: "Children",
    hasChildren: "HasChildren"
});

I cannot use it in the datasource.

Must be missing something here, please advice. Would like to use the model for CRUD operations elsewhere and want to use the same model in the treeview.
Daniel
Telerik team
 answered on 15 Feb 2013
4 answers
229 views
Hi, 

I am unable to send parameters for a DELETE (destroy) as urlencoded (it gets sent in the request body instead). I am able to send parameters for GET as urlencoded, but not for DELETE. I have the following defined in a datasource below.

Any ideas?

Cheers,
Vaughn
KendoUI version: 2012.3.1315
Platform: Phonegap 2.2.0 on Android 2.2 API (running on Android 4.2 Phone). 

----
var access_token = "something";
var url = "http://something.com/something";
read: {

  url: url, 
dataType: "json",
contentType: "application/x-www-form-urlencoded",
data: {
access_token: access_token,
}                
},
destroy: {
url: "determined at runtime",
type: "DELETE",
contentType: "application/x-www-form-urlencoded",
data: {
access_token: access_token,
},
},
parameterMap: function(options, type) {
return options;
}



Vaughn
Top achievements
Rank 1
 answered on 14 Feb 2013
4 answers
89 views
My grid has lost it's mind. Why am I seeing two pager sections? One that seems to work and the other has no idea?

Does any one know how or why this could happen?  Code Below.



View

@(Html.Kendo().Grid<AppointmentsDTO>()

                .Name("divgrid")

                .Columns(columns =>

                {

                    columns.Bound(o => o.MemberFirstName).Title("Member<br/>First Name");

                    columns.Bound(o => o.MemberLastName).Title("Member<br/> Last Name");

                    columns.Bound(o => o.ClientMemberID).Title("Client<br/>MemberID");

                    columns.Bound(o => o.ProviderID).Title("ProviderID");

                    columns.Bound(o => o.ProviderFirstName).Title("Provider<br/> First Name");

                    columns.Bound(o => o.ProviderLastName).Title("Provider<br/> Last Name");

                    columns.Bound(o => o.AppointmentDate).Title("Appointment<br/> Date");

                    columns.Bound(o => o.IHAAppointmentID).Hidden(true);

                })

                .DataSource(dataSource => dataSource

                .Ajax()  

                .Read(read => read.Action("ScheduledAppointments", "AppointmentScheduling")

                .Data("additionalData")

                    //the name of the JavaScript function which will return the additional data

                ))

               .Pageable() 

               .AutoBind(false)   

               .Scrollable()

          )

 JavaScript

$('#btnSearch').click(function () {

        DoSearch();

    });

   

    function DoSearch() {

        var grid = $("#divgrid").data("kendoGrid");

        grid.dataSource.read();       

    }

 

    function additionalData() {

        return {

            beginDate: $("#startDate").val(),

            endDate: $("#finishDate").val()

        };

    }

Controller

[HttpPost]

        public ActionResult ScheduledAppointments([DataSourceRequest]DataSourceRequest request, string beginDate, string endDate)

        {

            //calling service           

            var result = model.AppointmentList.ToDataSourceResult(request);

            JsonResult jresult = GetJsonResult(result, true);

 

            return jresult;

        }

 


Eric
Top achievements
Rank 1
 answered on 14 Feb 2013
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
MultiColumnComboBox
Chat
DateRangePicker
Dialog
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Effects
Accessibility
PivotGridV2
ScrollView
BulletChart
Licensing
QRCode
ResponsivePanel
Switch
Wizard
CheckBoxGroup
TextArea
Barcode
Breadcrumb
Collapsible
Localization
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
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?