Telerik Forums
Kendo UI for jQuery Forum
4 answers
424 views
I'm having issues when we try to refresh our kendo grid if we use a factory promise in our datasource.  Here is a code sample of what we are trying to do:

In the html file:

<div data-ng-controller="ModalUserInbox as vm">
    <div kendo-grid="vm.grid" options="vm.mainGridOptions" height="300"></div>
</div>

In the controller:

vm.mainGridOptions = {
                dataSource: {
                    type: "json",
                    transport: {
                        read: 
                            function (e) {
                            UserInboxFactory.getUserInbox().
                            then(function (data) {
                                e.success(data);
                            });
                        }
                    },
                    schema: {  
                        model: {  
                            fields: {  
                                ColumnSelected: { type: "boolean" },
                                Extension: { type: "string", editable: false },
                                Subject: { type: "string", editable: false },
                                Client: { type: "string", editable: false },
                                CreatedOn: { type: "date", editable: false }
                            }  
                        }  
                    },
                    pageSize: 8,
                    serverPaging: false,
                    serverSorting: false,
                    autosync: true
                },

In the factory UserInbox:

function UserInboxFactory($http, $q, RequestContext, Utility) {
        var deferred = $q.defer();
        var service = {
            getUserInbox: getUserInbox
        };

        return service;

        function getUserInbox() {
            $http({
                method: "GET", cache: false,
                url: RequestContext.PathAPI + 'user/Message/UserInbox/'
            }).success(function (data) {
                deferred.resolve(data);
            }).error(function (response) {
                deferred.reject(response);
            })

            return deferred.promise;
        }
    }

This works great on first load but I added a refresh button which tries to refresh the data:

function refreshMessages() {
            var grid = $("#grid").data("kendoGrid");

            grid.dataSource.read();
            grid.refresh();
        }

I can see the call to get the data but the data never actually refreshes.  What am I doing wrong?  If I change the read to directly use the url from the factory everything works perfect.


Kiril Nikolov
Telerik team
 answered on 21 Nov 2016
3 answers
5.0K+ views
If I have a Grid with the selection mode cell how can I get the selected cells column name and database field?  I can get the row and all the items on the row but I'm having a bit of trouble finding anything with just the cell information.  It would be nice to get the row and the column index also of the selected cell. I need to create a new grid by filtering with the column field.

Thanks
Kiril Nikolov
Telerik team
 answered on 21 Nov 2016
6 answers
353 views

It appears setting the Expanded property in the ItemDataBound event doesn't work. Is that correct?  What options do I have?

For example:  Setting item.Expanded doesn't appear to do anything.  (I verified IsExpanded is true in my models)

@(Html.Kendo().TreeView()
  .Name("TestTree")
  .ExpandAll(false)
  .BindTo(Model.Items, mappings =>
  {
     mappings.For<MyModelClass>(binding =>
       binding.ItemDataBound((item, child) =>
       {
         item.Text = child.Name;
         item.Selected = child.IsSelected;
         item.Expanded = child.IsExpanded;
       })
       .Children(x => x.ChildItems)
     );
   })
 )

Veselin Tsvetanov
Telerik team
 answered on 21 Nov 2016
11 answers
847 views

All of our CRUD via inline grid / popups are being  are being followed by a full read of the datasource to keep things in synch (please see sample transport code).

I know this full refresh of the datasource is not necessary. I am trying to understand what is required :

1) Following a successful deletion do I need to delete a row from the grid and datasource and how?

2) Following a successful update do I need to set reset dirty flags to false? Anything else?

3) Following a successful insert how do return extract new key id value and use to synch grid and datasource ?

 

 

transport:
{
    read: function (options) {
        $.ajax({
            url: siteUrlRel  + "/Handlers/GenericHandler.aspx?sp=sp_getAddresses",
            dataType: "json",
            type: "GET",
            cache: false,
            contentType: "application/json; charset=utf-8",
            success: function (result) {
                options.success(result);
            }
        });
    },
    create: function (options) {
        $.ajax({
            url: siteUrlRel  + "/Handlers/GenericCRUDHandler.aspx?sp=sp_addAddress",

            data: encodePlus(kendo.stringify(options.data)),
            dataType: "json",
            async: false,
            type: "POST",
            success: function (response) {
                addressesDataSource.read();
            },
            error: function (response) {
                alert(response);
                addressesDataSource.cancelChanges();
            }
        });
    },
    update: function (options) {
        $.ajax({
            url: siteUrlRel  + "/Handlers/GenericCRUDHandler.aspx?sp=sp_updateAddress",

            data: encodePlus(kendo.stringify(options.data)),
            async: false,
            dataType: "json",
            type: "POST",
            success: function (response) {
                addressesDataSource.read();
                UpdateMessage("Addresses changes applied");
            }
        });
    },
    destroy: function (options) {
        $.ajax({
            url: siteUrlRel  + "/Handlers/GenericCRUDHandler.aspx?sp=sp_deladdresses",
               data:encodePlus(kendo.stringify(options.data)),
            async: false,
            type: "POST",
            success: function (response) {
                addressesDataSource.read();
            },
            error: function (response) {
                alert(response.responseText);
                addressesDataSource.cancelChanges();
            }
        });
    },
    parameterMap: function (options, operation) {
        if (operation !== "read" && options.models) {
            return { models: kendo.stringify(options.models) };
        }
    }
},

Stefan
Telerik team
 answered on 21 Nov 2016
4 answers
586 views

I am trying the following code to change the border bottom color of an 'li' element in a list-view

http://dojo.telerik.com/ApIp/27

It does not work

Could you please let me know what's the issue ?

 

devApps
Top achievements
Rank 1
 answered on 21 Nov 2016
1 answer
148 views

There's probably a simple way to do this but I'm darned if I can figure out what.

I want to build a stacked bar chart roughly similar to the example at http://demos.telerik.com/kendo-ui/bar-charts/stacked-bar. The chart will show the top-N user activity per day. So for today, let's say that Alice did 100 units of work, Bob did 75, and Carole did 82. I want the stack to reflect that. Yesterday Mike did 75, Alice did 84, and Eve did 84.

I'm having a hard time figuring out how to get the stacks to reflect my data. Basically what I want is a stack for each day, with each "slice" of the stack showing activity. All of the Kendo chart types seem to assume that you'll have the same stacks every day, e.g. that every day I want to show what Alice, Bob, and Carole did. What I actually want is to show a stack per day where the components of the stack show (and the tooltip reflects) whatever the most active users for that day did. The same users may be most-active on multiple days but they may not.

Is there a straightforward way to do this with the built-in chart types?

Iliana Dyankova
Telerik team
 answered on 21 Nov 2016
1 answer
103 views

Hi,

I have some Kendo mobile buttons, and outside a Kendo grid they're style is as expected  (ie. with "km-button" classes and data-icon="compose").

However when I put them into a grid (via an MVVM data-row-template), they change/lose their icons and style. Clearly this is because, being in the grid, they're inheriting from a kendo (k) class of the grid - and this overrides their kendo mobile (km) class.

Is there a easy way to render buttons in their kendo mobile form within a grid? Or somehow tell the grid to "act mobile"?

Many thanks

- Paul 

(I see in the kendo mobile demo grid here: https://demos.telerik.com/kendo-ui/m/index#grid/adaptive that most of its contents are rendered with Kendo (k) classes. Perhaps this means the grid excludes or does not support content with "km" classes?) 

 

ptw
Top achievements
Rank 1
 answered on 20 Nov 2016
1 answer
191 views

Hello,

I'm trying to export some columns in a grid without hiding them. Now I'm using something like this:

 var $grid = $('#grid').data('kendoGrid');

for(var i=0; i<columnsthatIdontneed.lenght;i++){

$grid.hideColumn(columnsthatIdontneed[i]);

}

 $grid.saveAsExcel();//or $grid.saveAsPDF();

for(var i=0; i<columnsthatIdontneed.lenght;i++){
$grid.showColumn(columnsthatIdontneed[i]);
}

I need a solution for export without hiding those columns.

Thanks.

Alex Hajigeorgieva
Telerik team
 answered on 18 Nov 2016
8 answers
540 views

Hi,

Is it possible to create a drop down list always open (like html element select with attribute size) ?

Thanks,

Matthieu

Patrick | Technical Support Engineer, Senior
Telerik team
 answered on 18 Nov 2016
3 answers
193 views

is it possible to use the different chart icons as it is done in the demos

<span class="sparklineIcon"></span>

<span class="chartBarIcon"></span>

<span class="chartPieIcon"></span>

...

Where can i find the styles?

Thx in advance

Rumen
Telerik team
 answered on 18 Nov 2016
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
ScrollView
Switch
TextArea
BulletChart
Licensing
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
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
SegmentedControl
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?