0

I've written a custom editor for Slickgrid which shows drop down box with items from sql db. These items are in the formal [id] [text]

I wish to store the [id] into the slickgrid data, but show the [text] to the user. There doesn't appear to be a callback for "display" rather than "store", so not sure how to do this? Hopefully I don't have to write a custom renderer as well?

eg.

this.init = function () {
                        $select = $("<SELECT tabIndex='0' class='editor-result'><OPTION value='1'>Passed</OPTION><OPTION value='0'>Failed</OPTION></SELECT>");
                        $select.appendTo(args.container);
                        $select.focus();
                    };

this.serializeValue = function () {
                        return $select.val();
                        };

this.applyValue = function (item, state) {
                        item[args.column.field] = state;
                        };
Moose
  • 109
  • 1
  • 10
  • See this [Link](http://stackoverflow.com/questions/3211956/slickgrid-select-editor/21744983#21744983) – HeiN Mar 09 '14 at 23:04

1 Answers1

0

It appears that yes, I do have to add a custom renderer (or rather, a formatter), but it's quite simple, so not so bad:

function ResultFormatter(row, cell, value, columnDef, dataContext) {
    return value ? "Passed" : "Failed";
  } 
Moose
  • 109
  • 1
  • 10