Telerik Forums
Kendo UI for jQuery Forum
2 answers
191 views
Question:

I have a simple mobile app that consists of four tabStrip items which, in their respective views, contain scollable lists.  I can't wrap my head around navigating from a list-view item link to a content page.  The problem is when I click the link nothing happens --no transitions, zilch.  Here's my code:

// Sample TabStrip View containing a slightly modified list item link to a div
<div data-role="view" id="tabstrip-generes" data-title="Generes" data-layout="mobile-tabstrip">
<ul data-role="listview">
<li>
<a class='km-listview-link' src='#filmA'>Film A</a>
</li>
</ul>
</div>

// Desired view to navigate to
<div data-role="view" id="filmA">
Film Details, etc.  Basic content page; this single view will be repopulated with content depending upon what list-item link item is clicked then shown.
</div>

// Bottom Tab Strip
<div data-role="layout" data-id="mobile-tabstrip">
    <header data-role="header">
        <div data-role="navbar">
            <span data-role="view-title"></span>
            <a data-align="right" data-role="button" class="nav-button" href="#index">Index</a>
        </div>
    </header>

    <div data-role="footer">
        <div data-role="tabstrip">
            <a href="#tabstrip-home" data-icon="contacts">Home</a>
            <a href="#tabstrip-generes" data-icon="history">Generes</a>
            <a href="#tabstrip-search" data-icon="favorites">Search</a>
            <a href="#tabstrip-news" data-icon="settings">News</a>
        </div>
    </div>
</div>

Any help would be appreciated.

-Chris
Christopher
Top achievements
Rank 1
 answered on 11 May 2012
3 answers
233 views
I have a problem with a dataSource for a kendo grid. The dataSource consumes JSON endpoints for CRUD operations on a remote DB.

The JSON endpoints that the dataSource is consuming contain different root elements for read versus the other methods. The root element for a read is "GetFooResult.RootResults". The root element for all other methods is "SubmitChangesResult". The endpoints are created by the .NET DomainServices JSON endpoint factory, so I don't necessarily have influence over what format they return.

The problem is that the dataSource is not able to parse the returned JSON for methods except read, since that is what the dataSource:schema:data element is based on. Therefore when I execute a create operation it does not recognize the returned JSON; each subsequent create continues to attempt to send all previous create attempts, which creates duplicate records in the DB.

Any idea how to specify different dataSource:schema:data elements for the various transport methods? There seems to be only one schema with one data element per datasource. Could I write code under parameterMap that sets this element depending on the transport method?

Thanks,
David
David
Top achievements
Rank 1
 answered on 11 May 2012
2 answers
275 views
Hi
I'm trying to use mvvm and templates to produce a grid with column totals. A fairly simple scenario I think. I can get the grid to render and the column footer to show. However, I no longer have the ability to edit the grid cells (due to the row template that I am using). What can I do to make the rows function as if I was not using the template, and binding the products list to the table instead. Or can I just bind to the table and somehow have a custom footer that I can use to bind to my view-model with calculated totals. BTW I can just use a datasource and "sum" aggregate as I want to do some "math" to produce the total.
I have a jsfiddle of the scenario.
http://jsfiddle.net/darrenarbell/K9tnS/26/

Thanks in advance

Regards

 
Iliana Dyankova
Telerik team
 answered on 11 May 2012
4 answers
235 views
I'm trying to call an MVC controller action to populate my grid and I need to pass a parameter to it. However, my breakpoint in the action isn't getting hit. Am I doing something wrong here? I can't tell if my param is making it through since my breakpoint isn't getting hit. Do I need to set up a route for this call?

Action:

[HttpGet]
public JsonResult GetSalesHistory(string id)
{
    List<Sales> sales = PestsLogic.GetSalesById(5);
    return Json(new { data = sales, total = sales.Count }, JsonRequestBehavior.AllowGet);
}

JavaScript code:

<script type="text/javascript">
    $("#grid").kendoGrid({
        dataSource: {
            type: "json",
            transport: {
                read: {
                    url: "Sales/GetSalesHistory",
                    dataType: "json",
                    type: "GET",
                    contentType: "application/json; charset=1-8",
                    data: { id: "@ViewBag.CustomerEstimateKey" }
                }
            },
            pageSize: 15,
            schema: {
                data: "data",
                total: "total"
            }
        },
        pageable: true,
        sortable: true
    });
</script>
Jay
Top achievements
Rank 1
 answered on 11 May 2012
1 answer
921 views
Hi,

Can you please provide the way to correct edit date type column in grid
I have following parts
 defined model
var Model = kendo.data.Model.define({
                id: "Id",
                fields: {
                    SDate: { nullable: true, type: "date" } }});
and define column in grid

{
                field: "SDate",
                title: "Date",
                type: "date",
                template: "#= (SDate== null) ? ' ' : kendo.toString(toDate(SDate), 'MM/dd/yyyy') #"
            }
When records come from json result template for this column shows date correctly but once I click into cell to edit date picker has \Date(123123123123) value as input. It seems like datepicker doesn't parse json date format to edit.
Any ideas on this?

Phillip
Top achievements
Rank 2
 answered on 11 May 2012
1 answer
148 views
I have a grid with a popup edit window. The edit window comes up without problem. When I edit I get the popup window with the appropriate fields. When I click update after editing the description the javascript fails with the following code highlighted:

return isFinite(b.valueOf())?b.getUTCFullYear()+"-"+pad(b.getUTCMonth()+1)+"-"+pad(b.getUTCDate())+"T"+pad(b.getUTCHours())+":"+pad(b.getUTCMinutes())+":"+pad(b.getUTCSeconds())+"Z":null}

Anyone have any thoughts on why this is happening?

Page code is as follows:

@model HopitelNetworksPlatform.Models.FacilityProblem
 
@{
    ViewBag.Title = "ProblemTracking";
}
 
 
<h2>Problem Tracking<br />
Facility: @Model.FacilityName
</h2>
 
<p>
    @Html.ActionLink("Add Problem", "CreateProblem", new { facilityID = Model.FacilityID } )
</p>
 
<div id="test"></div>
<div id="problemGrid"></div>
 
<script type="text/javascript">
 
    var gridLoaded = false;
 
    var categoryData = new kendo.data.DataSource({
         
        schema: {
            model: {
                id: "ProblemCategoryID",
                fields: {
                    ProblemCategoryID: { type: "int" },
                    ProblemCategoryName: { type: "string" }
                }
            }
        },
        transport: {
            read: {
                url: "@Url.Action("ProblemCategoryList", "Diagnostic")",
                type: "POST"
            }
        }
    });
    categoryData.read();
 
    var bedData = new kendo.data.DataSource({
         
        schema: {
            model: {
                id: "RoomBedID",
                fields: {
                    RoomBedID: { type: "int" },
                    RoomBedName: { type: "string" }
                }
            }
        },
        transport: {
            read: {
                url: "@Url.Action("RoomBedList", "Facility", new { facilityID = Model.FacilityID })",
                type: "POST"
            }
        },
        change: function(e) {
            if(gridLoaded == false) {
                DisplayGrid();
                gridLoaded = true;
            }
        }
    });
    bedData.read();
 
    function lookupCategoryName(ProblemCategoryID)
    {
        if(ProblemCategoryID == undefined) {
            return "";
        }
        else {
            var problemCategory = categoryData.get(ProblemCategoryID);
            return problemCategory.ProblemCategoryName;
        }
    }
      
    function lookupBedName(RoomBedID)
    {
        if(bedData.total() == 0)
        {
            return RoomBedID.toString();    //(todo)(change to unknown or something)
        }
        else
        {
            if(RoomBedID == undefined) {
                return "";
            }
            else {
                var roomBed = bedData.get(RoomBedID);
                return roomBed.RoomBedName;
            }
        }
    }
    
 
function DisplayGrid() {
 
    $("#problemGrid").kendoGrid({
        pageable: true,
        columns: [
            { field: "RoomBedID", title: "Location", width: "5%",
                editor: function(container,options) {
                    $('<input name="' + options.field + '"/>').appendTo(container).kendoDropDownList({
                        dataSource: bedData,
                        dataValueField: "RoomBedID",
                        dataTextField: "RoomBedName",
                        autobind: false
                     });
                 },
                 template: "#= lookupBedName(RoomBedID) #"              
            },
            { field: "DateReported", title: "Date Reported"  },
            { field: "ProblemCategoryID", title: "Problem Type",
                editor: function(container,options) {
                    $('<input name="' + options.field + '"/>').appendTo(container).kendoDropDownList({
                        dataSource: categoryData,
                        dataValueField: "ProblemCategoryID",
                        dataTextField: "ProblemCategoryName",
                        autobind: false
                     });
                 },
                 template: "#= lookupCategoryName(ProblemCategoryID)  #"
            },
            { field: "ProblemDescription", title: "Problem Description" , width: "30%" },
            { field: "DateResolved", title: "Date Resolved" },
            { field: "ResolutionDescription", title: "Resolution", width: "30%" },
            { command: "edit", title: "Edit", width: "110px" }
        ],
        editable: "popup",
        toolbar: ["create", "save", "cancel"],
        dataSource: {
            schema: {
                model: {
                    id: "ProblemID",
                    fields: {
                            ProblemID: { type: "int", editable: false, nullable: true },
                            RoomBedID: { type: "int", nullable: true },
                            RoomBedName: { type: "string" },
                            DateReported: { type: "date", editable: false },
                            ProblemCategoryID: { type: "int", nullable: true },
                            ProblemCategory: { type: "string" },
                            ProblemDescription: { type: "string" },
                            DateResolved: { type: "date", nullable: true, editable: false },
                            ResolutionDescription: { type: "string", nullable: true }
                    }
                }
            },
            batch: true,
            pageSize: 10,
            transport: {
                create: {
                    url: "@Url.Action("CreateProblem2", "Diagnostic")",
                    type: "POST"
                },
                read: {
                    url: "@Url.Action("ProblemList", "Diagnostic", new { facilityID = Model.FacilityID })",
                    type: "POST"
                },
                update: {
                    url:"@Url.Action("UpdateProblem", "Diagnostic")",
                    type: "POST"
                },
                destroy: {
                    url: "@Url.Action("DestroyProblem", "Diagnostic")",
                    type: "POST"
                }
            }
        }
    });
}
 
 
</script>


Alexander Valchev
Telerik team
 answered on 11 May 2012
1 answer
112 views
Hi,

Is it possible to creating own url query string to web service in DataSource and how to do that?

Instead of making request with url generated from DataSource like /data/GetAll?take=5&skip=5...
I want to create request with url in RESTful convention like data/GetAll/take/5/skip/5...
Alexander Valchev
Telerik team
 answered on 11 May 2012
3 answers
735 views
Hi,
I want to move the data that are checked in the grid to another grid when i clicked the button and if it is check all all then i have to move all the data from one gird to another and empty the other grid please find the screen shots below

Very urgent

Thanks in advance.

Ricardo
Top achievements
Rank 1
 answered on 11 May 2012
1 answer
221 views
I am building a mobile application and am using the datasource feature to perform CRUD operations.  The buttons that initiate the destroy and update on the transport are in a different view from where the datasource is described.

For example, the listmessages view has a listView widget to display all the messages (from the datasource), when one is selected, they are directed to the viewmessage remote view.

When in this view I want to initiate the update and destroy on the datasource in the previous view (listmessages ).

I currently use PHP to display the data on viewmessage view and would prefer to access the relevant dataSource id to display the selected data.

Hope this makes sense.  Please see my code for a better idea of what I am trying to achieve.

<div data-role="view" data-title="Mobile" id="listmessages" data-init="listMessagesInit">
        <h2>Customer Messages</h2>
        <p><?php echo $unread_messages . ' - unread messages'; ?></p>
        <ul id="message_list"></ul>
    </div>
      
    <script id="message_list_template" type="text/x-kendo-template"><a href=""><div style="float:left; width:150px; height: 50px" class="isnew_#= isnew #">#= customer_name #<br />#= created #</div><div style="height: 50px"id="message_#= id #" class="isnew_#= isnew #">#= message #</div></a></script>
  
<script>
     function listMessagesInit(){
           
          var dataSource = new kendo.data.DataSource({
             
            transport: {
                read: "/messages/data",
                dataType: "json",
                update: {
                    url:  function() {
                        //where id is a global variable
                        var url = "/messages/markasread/" + id + "/" + read;
                        return url;
                    },
                    type: "POST",
                    dataType: "json"
                    //other configurations
                },            
  
                destroy: {
                    url:  function() {
                        //where id is a global variable
                        var delurl = "/messages/delete/" + id;
                        return delurl;
                    },                    
  
                    type: "DELETE",
                    dataType: "json"
                }
                          
            },              
            schema: {
              model: {
                  id: "id",
                  fields: {
                      created: { type: "string" },
                      message: { type: "string" },
                      customer_name: { type: "string" },      
                      isnew: { type: "string" }
                     }
                       
                 }
             
                   
           });
                    
  
          $("#message_list").kendoMobileListView({
              dataSource: dataSource,
              //pullToRefresh: true,
                          //appendOnRefresh: true,
              style: "inset",
              click: function(e) {
                var id = e.dataItem.id;
                var selected = dataSource.get(id);
                window.kendoMobileApplication.navigate("/messages/view/" + id);
              },        
              template: $("#message_list_template").text()
          });
  
     }
    </script>
      
    <style>
    #listmessages div.isnew_1 {font-weight:bold}
    #listmessages div.isnew_0 {font-weight:normal}
      
   </style>
    <div data-role="view" data-title="Mobile" id="viewmessage" data-init="viewMessageInit">
    <h2>Message</h2>
        <p>Date: <?=$message->message->created?></p>
        <p>From: <?=$message->message->customer_name?></p>
        <p>Email: <a href="mailto:<?=$message->message->email?>" target="_blank"><?=$message->message->email?></a></p>
        <p>Telephone: <?=$message->message->customer_telephone?></p>
        <p>Location IP:<?=$message->message->ip?></p>
        <div data-role="scroller">
            <p><?=$message->message->message?></p>
        </div>
        <?php $read_text = ($message->message->isnew == 1 ? 'Mark as read' : 'Mark as unread'); ?>
        <?php $read = ($message->message->isnew == 1 ? 0 : 1); ?>
        <p><a data-align="left" data-role="button" id="markasread" ><?=$read_text?></a>
        <a data-align="right" data-role="button" id="delete">Delete</a></p>
         
    </div>
    <script>
  
      
    function viewMessageInit(){
          //var selected is defined in previous view - how to access this?
          $("#markasread").click(function(){    
            selected.set("isnew", read);  
            dataSource.sync();        
          }); 
            
          $("#delete").click(function(){
            dataSource.remove(selected);
            dataSource.sync();        
          }); 
                    
  
    }
      
</script>

Many thanks in advance for any advice.
Lee
Top achievements
Rank 1
 answered on 11 May 2012
3 answers
171 views
I want a function to return some html into a data-bind="text: getText" but it comes across literally...like if I do

return "<span class='incomplete'>InComplete</span>";

then it renders
<span class='incomplete'>InComplete</span>

And if I encode it, it just renders the encoded strings.

Suggestions?
sitefinitysteve
Top achievements
Rank 2
Iron
Iron
Veteran
 answered on 11 May 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
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?