jquery - database binding of jqwidget dropdownlist in grid cell -


In the jqwidget grid example (jqxGrid open, edit / edit under the left menu), the data is generated on the client . How can I tie a dropdown list in the database inside the Net MVC3 project? (You can see the dropdown list under Product column in the Demo tab)

Dropdown list with database When starting, it should be connected to the data source (or datadetter), and set the selectedex-set. Then, the selected value for the row should be kept on the selection.

The definition of the column can be:

  {text: 'urun', column type: 'dropdown list', datafield: 'urun', width: 177, Inferior: function line, cell value, editor) {var urunId = $ ('# jqxgrid'). JqxGrid ('getcellvalue', line, "UrunId"); Editor. JqxDropDownList ({displayMember: 'UrunAdi', source: dropdown list adapter, selected index: urunId}); $ (Document). On ('Select', Editor, Tasks (Event) {selectedUrunId = editor.jqxDropDownList ('getSelectedIndex');}); }}   

The variable "selectUrunId" should be defined globally, perhaps var selectedUUID = -1; Like the jqxgrid initialization, then the selected value of the dropdown should be used (in this source definition) in the Updrover definition. It could be:

  if (selected URIID = undefined and selected URIID! = -1) {rowdata.UrunId = selectedUrunId; SelectedUrunId = -1; }   

The overall view for this scenario is:

  // create the data var gridSource = {Data Type: "Jason", Datafield: [ Name: 'cargoed'}, {name: 'urun addi'}, {name: 'uruid', type: 'int'}], url: 'bindgrrid', uprovero: function (rarid, rowdata) {// server Synchronizes with - Send an update command if selected (URIID! = Undefined and selected URIID! = -1) {rowdata.UrunId = selectedUrunId; SelectedUrunId = -1; } Var data = $ .adm (rowdata); $ AJAX ({Data Type: 'JSN', URL: 'Update Edit Grid', Data: Data, Success: Function (Data, Status, External) {gridDataAdapter.dataBind ();}, Error: Function (Excerpt, Status, Error) {Warning (JSON.stringify (xhr))}}}); }}; Var GridData Adapter = New $ .jqx.dataAdapter (gridSource); Var Dropdown Source = {DataType: "JSON", Datafield: [{Name: 'Uruni ID'}, {Name: 'UrunaAdi'}], URL: 'Bindedropdown'}; Var selectedUrunId = -1; Var dropdown listedender = new $ .jqx.dataAdapter (dropdown source); // {jquxGrid $ ("# jqxgrid"). JquxGrid ({width: 670, source: grid data adapters, editable: true, theme: theme, selection mode: 'singlecel', column: [[text: '#', datafield: cargoed, width: 40}, {text: 'Urun', column type: 'dropdown list', datafield: 'urun adi', width: 177, infer: function (row, cellavel, editor) {var urunId = $ ('# jqxgrid $ (document) .on (' Select ', editor, etc.). (' Displayer: 'UruniAdi, source: dropdown list adapter, selected index: urunId}); function (event) {selectedUrunId = edi Tor.jqxDropDownList ('getSelectedIndex');})}}}]});    

Comments