slickgrid

Writing custom formatters for slick grid

风流意气都作罢 提交于 2019-12-04 14:50:05
While writing custom cell formatters function PercentCompleteFormatter(row, cell, value, columnDef, dataContext) This is the basic definition we have to follow.can i get explanation about dataContext argument in slick grid.What it actually represents. The exact code for this is function PercentCompleteFormatter(row, cell, value, columnDef, dataContext) { if (value == null || value === "") { return "-"; } else if (value < 50) { return "<span style='color:red;font-weight:bold;'>" + value + "%</span>"; } else { return "<span style='color:green'>" + value + "%</span>"; } } I just want what

How to put HTML into Slickgrid cell?

筅森魡賤 提交于 2019-12-04 08:16:20
When I put <a href="#">Click</a> into slickgrid, I see the actual code " <a href="#">Click</a> ", whereas I expect the link to be rendered. I know I can do it by subscribing click event but is it restricted thing in SlickGrid? Write a custom formatter: function myFormatter(row, cell, value, columnDef, dataContext) { return "<a href='#'>Click</a>"; } and specify it in the column definition. From @RicardoStuven Or use the defaultFormatter option to treat any value as HTML: defaultFormatter: function (row, cell, value, columnDef, dataContext) { if (value == null) return ''; return value.toString(

SlickGrid RemoteModel vs. Dataview Model

人盡茶涼 提交于 2019-12-04 07:33:24
We're currently using the slick.remotemodel.js model implementation of SlickGrid for its remote Ajax loading functionality. With this example the only filtering provided is a simple Search element. What we're looking to accomplish is a much more robust filtering method of each column, such as what is used in this example: http://mleibman.github.com/SlickGrid/examples/example-header-row.html Is there a way to easily combine the features of the Dataview model with the RemoteModel? Is it merely a matter of combining the functions of Dataview into the RemoteModel code, or is there more of a

resizing of grid when resizing browser window

天涯浪子 提交于 2019-12-04 05:31:35
I used a fill whole window example as a default. Tried to resize browser window: but area, that is used for grid is the same. Need to reload page so that it fits. How can I archive this without reloading page ? Edited Interesting fact that when I change order of columns grid is resized. This works fine for me. Maybe the resizeCanvas() function is a new feature in slick grid. The code is CoffeeScript. $(window).resize -> grid.resizeCanvas() This works better than just changing .slick-viewport height. $(window).resize(function(){ var h=$(window).height(); $('#myGrid').css({'height':(h-65)+'px'})

Do action after render() method is completed

你。 提交于 2019-12-04 03:15:52
I need to do some action when render() method finished its work and appended all HTML elements to DOM. How to subscribe to onRenderEnds event (there is no such event)? Can I write my own event outside of slickgrid code and attach it to render() method? There are some events "onScroll", "onViewportChanged" but they happened before render() finished (in some cases). Update: I write formatter for column: formatter: function(row, cell, value, columnDef, dataContext){ return "<div class='operationList' data-my='" + myData + "'></div>"; } When grid rendered (applying my formatter) i need to go

Slickgrid: Final column autosize to use all remaining space

杀马特。学长 韩版系。学妹 提交于 2019-12-04 01:44:47
问题 I'm using SlickGrid and struggling to find an elegant solution to the following: All columns must have a specific initial width when first rendered but be resizable afterwards The final column should auto fill the remaining column space when the window is resized I've seen: Make one column fill remaining space in SlickGrid without messing up explicit width columns resizing of grid when resizing browser window How do I autosize the column in SlickGrid? But these don't seem to quite do what I

Disabling specific cell edit in Slick grid

寵の児 提交于 2019-12-03 23:16:37
Is there a way to disable a cell for editing? We can define editor at column level but can we disable that editor for specific rows? grid.onBeforeEditCell.subscribe(function(e,args) { if (!isCellEditable(args.row, args.cell, args.item)) { return false; } }); You can disable or even change editor/formatter/validator... or other cell properties using getItemMetadata method. There is very nice documentation for this here . Example: $scope.data.data.getItemMetadata = function (row) { var item = $scope.data.data.getItem(row); if (item.some_condition) { return { columns : { yourColumnId : { editor :

Slickgrid Filtering without Dataview

Deadly 提交于 2019-12-03 21:44:34
Is it possible to filter a Slickgrid without using the DataView? In case it isn't possible, how should the data array be structured in order to display correctly? I don't have a working example atm. Thanks Later edit: After doing some more homework, a filterable datagrid is all about getting matching indexes in a nested array... to get a live sorted result-set that gets updated with grid.setData(filterData);grid render; one should do the following function intersect(a, b) // find an intersection of 2 arrays (google result on SO { var ai=0, bi=0; var a = a.sort(); var b = b.sort(); var result =

JSON deserialization throws circular reference ONLY in live build

匆匆过客 提交于 2019-12-03 21:38:22
问题 I have a strange issue that I can't wrap my head around. I am trying to create an "export to csv" function for my MVC4 application where the relevant JSON is passed via an ajax call to my ActionResult. The ActionResult deserializes the stringify'd JSON (with JSON.Net), writes it to a file in csv format, then returns the server path to the new file. My success callback then receives the path and calls the url to download. This works fine locally, but on my live test server I get the following

How to get slickgrid div to resize with size of table

戏子无情 提交于 2019-12-03 21:32:55
问题 I hope we have some users familiar with slickGrid seeing as how StackOverflow uses it also :) I have a HTML containing my slickGrid as follows: <div style="position:relative; overflow:visible; width:600px; margin:25px 0 0 0;"> <div id="myGrid" style="width:100%;overflow:visible; min-height:100px; max-height:300px;"></div> </div> <div class="options-panel"> <h2>Demonstrates:</h2> <ul> <li>adding basic keyboard navigation and editing</li> <li>custom editors and validators</li> <li>auto-edit