jQWidgets Forums

jQuery UI Widgets Forums Grid Grid with combobox

This topic contains 2 replies, has 2 voices, and was last updated by  crballon 9 years ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Grid with combobox #83836

    crballon
    Participant

    Hello friends, I’m just starting to learn this new framework, I would love for you to help me with this problem I’m having in the combobox included in the grid, my problem is that I’m sending to values to the combo box, IdMod and Name, I can visualize the grid with the name perfectly, but when I select the name, it shows the IdMod and not the name, what I want to do is to list the names in the combo box and a way to obtain the value of the object I selected

    Here my code:
    var sourcetype =
    {

    datatype: “json”,
    datafields:
    [

    { name: ‘Nombre’, type:’string’},
    { name: ‘IdMod’, type:’string’}

    ],

    url: ‘/Servicio/GetModeloAntena’, id:’id’,
    async:false,

    };

    var dataAdapterType = new $.jqx.dataAdapter(sourcetype,{autoBind: true});

    var idofer = @ViewBag.IdNodo;
    // prepare the data
    var source =
    {
    datatype: “json”,
    datafields: [
    {name: ‘IdCelda’},
    {name: ‘IdSector’},
    { name: ‘NumeroSector’ },
    {name: ‘ModeloAntena’},

    { name: ‘AplicaPortadora’ },
    { name: ‘Portadora’},
    { name: ‘CodigoUnico’},
    { name: ‘Azimuth’},
    { name: ‘Tiltelectrico’},
    { name: ‘TiltMecanico’},
    { name: ‘FechaPuestaServicio’},
    { name: ‘Bts’},
    { name: ‘Cisac’}
    ],

    url: “/Servicio/GetSectoresCeldas/?IdNodo=” + idofer,
    id: ‘IdNodo’,

    };

    var addfilter = function () {
    var filtergroup = new $.jqx.filter();
    var filter_or_operator = 1;
    var filtervalue = ‘Beate’;
    var filtercondition = ‘contains’;
    var filter1 = filtergroup.createfilter(‘stringfilter’, filtervalue, filtercondition);
    filtervalue = ‘Andrew’;
    filtercondition = ‘starts_with’;
    var filter2 = filtergroup.createfilter(‘stringfilter’, filtervalue, filtercondition);

    filtergroup.addfilter(filter_or_operator, filter1);
    filtergroup.addfilter(filter_or_operator, filter2);
    // add the filters.
    $(“#jqxgrid”).jqxGrid(‘addfilter’, ‘firstname’, filtergroup);
    // apply the filters.
    $(“#jqxgrid”).jqxGrid(‘applyfilters’);

    };

    var dataAdapter = new $.jqx.dataAdapter(source);
    $(“#jqxgrid”).jqxGrid(
    {
    autoheight: true,
    groupable: true,
    width: ‘1650’,
    showaggregates: true,
    source: dataAdapter,
    filterable: true,
    sortable: true,
    showstatusbar: true,
    statusbarheight: 50,
    autoshowfiltericon: true,
    source: dataAdapter,
    selectionmode: ‘singlecell’,
    editable: true,
    ready: function () {
    var localizationobj = {};
    localizationobj.sortascendingstring = “Ordenar A-Z”;
    localizationobj.sortdescendingstring = “Ordenar Z-A”;
    localizationobj.sortremovestring = “Eliminar Orden”;
    localizationobj.filterorconditionstring = “o”;
    localizationobj.filterandconditionstring = “y”
    localizationobj.filterclearstring = “Quitar”;
    localizationobj.filterstring = “Filtro”;
    localizationobj.filterstringcomparisonoperators = [‘vacio’, ‘no vacio’, ‘contiene’, ‘contiene(match case)’,
    ‘no contiene’, ‘no contiene(match case)’, ’empieza con’, ’empieza con(match case)’,
    ‘termina con’, ‘termina con(match case)’, ‘igual’, ‘igual(match case)’, ‘nulo’, ‘no nulo’];
    localizationobj.filternumericcomparisonoperators = [‘igual’, ‘no es igual’, ‘menor que’, ‘menor que o igual’, ‘mayor que’,
    ‘mayor que o igual’, ‘nulo’, ‘no nulo’];
    localizationobj.filterdatecomparisonoperators = [‘igual’, ‘no igual’, ‘menor que’, ‘menor que o igual’, ‘mayor que’,
    ‘mayor que o igual’, ‘nulo’, ‘no nulo’];
    localizationobj.filterbooleancomparisonoperators = [‘igual’, ‘no igual’];
    localizationobj.filtershowrowstring = “Mostrar filas donde:”;
    $(“#jqxgrid”).jqxGrid(‘localizestrings’, localizationobj);
    addfilter();
    },

    columns: [
    {

    text: ‘Guardar’, datafield: ‘IdCelda’, width: 150, columntype: ‘button’, cellsrendered: function () {
    return “edit”;

    },
    buttonclick: function (row) {

    editrowindex = row;
    var idxx = $(“#jqxgrid”).jqxGrid(‘getcellvalue’, row, “IdCelda”);

    //here is where i get the value???
    var modantena = $(“#jqxgrid”).jqxGrid(‘getcellvalue’,row, “ModeloAntena”);
    //.————————–

    var portadora = $(“#jqxgrid”).jqxGrid(‘getcellvalue’, row, “Portadora”);
    var azimuth = $(“#jqxgrid”).jqxGrid(‘getcellvalue’, row, “Azimuth”);
    var tile = $(“#jqxgrid”).jqxGrid(‘getcellvalue’, row, “Tiltelectrico”);
    var tilm = $(“#jqxgrid”).jqxGrid(‘getcellvalue’, row, “TiltMecanico”);
    var bts = $(“#jqxgrid”).jqxGrid(‘getcellvalue’, row, “Bts”);
    var cisa = $(“#jqxgrid”).jqxGrid(‘getcellvalue’, row, “Cisac”);
    var idsect = $(“#jqxgrid”).jqxGrid(‘getcellvalue’, row, “IdSector”);

    window.location = ‘/Servicio/GuardarCelda/?IdCelda=’ + idxx+”&ModAntena=”+modantena+”&Portadora=”+portadora+”&Azimuth=”+azimuth+”&Tiltelec=”+tile+”&TiltMec=”+tilm+”&Bts=”+bts+”&Cisac=”+cisa+”&IdSector=”+idsect;

    }

    },
    {text: ‘IdSector’, datafield: ‘IdSector’, width: 200, hidden: true,hidden: true},

    { text: ‘NumeroSector’, datafield: ‘NumeroSector’, width: 200, hidden: true },
    {

    text: ‘Modelo Antena’, datafield: ‘ModeloAntena’, columntype: ‘combobox’,

    createeditor:function(row, cellvalue, editor)
    {
    editor.jqxComboBox({ autoDropDownHeight: false, source: dataAdapterType, displayMember: ‘Nombre’, valueMember: ‘IdMod’ });
    },

    cellvaluechanging: function (row, column, columntype, oldvalue, newvalue) {
    if (newvalue == “”)
    {
    return oldvalue.displayMember
    }
    else
    {
    newvalue.displayMember
    }

    }

    },

    { text: ‘AplicaPortadora’, datafield: ‘AplicaPortadora’, width: 100, editable:false },
    { text: ‘Portadora’, datafield: ‘Portadora’, width: 200, editable:true },
    { text: ‘CodigoUnico’, datafield: ‘CodigoUnico’, width: 100, editable:false},
    { text: ‘Azimuth’, datafield: ‘Azimuth’, width: 100, editable:true} ,
    { text: ‘Tiltelectrico’, datafield: ‘Tiltelectrico’, width: 100, editable:true} ,
    { text: ‘TiltMecanico’, datafield: ‘TiltMecanico’, width: 100, editable:true} ,
    { text: ‘FechaPuestaServicio’, datafield: ‘FechaPuestaServicio’, width: 100},
    { text: ‘Bts’, datafield: ‘Bts’, width: 100, editable:true},
    { text: ‘Cisac’, datafield: ‘Cisac’, width: 100, editable:true}

    ],

    groups:[‘NumeroSector’]
    });

    Grid with combobox #83841

    Peter Stoev
    Keymaster

    HI crballon,

    We have such example online: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/customcomboboxcolumn.htm?light. It shows how to display a ComboBox and have Key/Value pairs in the column

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    Grid with combobox #84073

    crballon
    Participant

    hello, I can not obtain the value of my conmobox,I use Button click, this obtain the values for each row, helpme plisss.

    someone could edit my code???

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.