Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Dynamic select options from server
24/06/2009
11:31
Avatar
bujinwang
Member
Members
Forum Posts: 12
Member Since:
17/06/2009
sp_UserOfflineSmall Offline

I have a column marked as "select" and I would like to dynamically specify the values from server. I have JSON/normal string ready from server.

I have tried to do ajax or $.JSON call, and the string is returned correctly as :

var locationData= ...get string from server;

and in colModal:

{
            name: 'locations',
            index: 'locations',
            width: 300,
            height: 800,
            editable: true,
            hidden: true,
            edittype: "select",
            editoptions: {
                multiple: true,
                value: locationData
            },
            editrules: {
                edithidden: true,
                required: true
            }
        }

it did not work! However if I specify the same string statically, it worked:

locationData = "1:loation1; 2:location2";

Burt

25/06/2009
08:53
Avatar
sarai
New Member
Members
Forum Posts: 1
Member Since:
24/06/2009
sp_UserOfflineSmall Offline

Hi Burt,

I just have the same problem, but I made a little trick to solve it, I don't know if there is another solution. By now I want to search my code with you.

I declare and input hidden and ther is where I put the values that I need in the select.

$(document).ready(function(){
     $.ajax({
        url:'tipomaquina.do?methodCall=getOptions',
        async : false,   //notice that async has to be false
        success: function(datos){
            $("#datos").val(datos);
        }
    });

    var idArea = $("#areas :selected").val();
   
    $("#table1").jqGrid({
        url:'tipomaquina.do?methodCall=fillTable&idArea='+idArea,
        datatype: 'xml',
        colNames:['Tipo de Maquina','Area'],
        colModel:[ {name:'tipoMaquina',index:'tipoMaquina', width:200, editable:true, edittype:'text',editrules:{required:true,size:30}},
                   {name:'area',index:'area', width:200, editable:true,edittype:'select',editoptions:{value:getOptions()},editrules:{required:true}}],
        rowNum:5,
        imgpath: gridimgpath,
        viewrecords: true,
        pager: $('#footer1'),
        caption:'Tipo de Máquina',
        editurl:'someurl'
    }).navGrid('#footer1',{edit:true,add:true,del:true,refresh:true,search:false,view:false},
                          {height:280,reloadAfterSubmit:true,top:130,left:500,url:'tipomaquina.do?methodCall=edit',closeAfterEdit:true},
                          {height:280,reloadAfterSubmit:true,top:130,left:500,url:'tipomaquina.do?methodCall=add'},
                          {height:150,reloadAfterSubmit:true,top:130,left:500,url:'tipomaquina.do?methodCall=delete'},
                          {});

    function getOptions(){
        return $("#datos").val();
    }

    $("#areas").change(function(){
        var idArea = $("#areas :selected").val();
        $("#table1").setGridParam({url:'tipomaquina.do?methodCall=fillTable&idArea=' + idArea,page:1}).trigger("reloadGrid");
   });
});

Hope this is useful to you. If there is someone that have another solution please let use know.

Thanks,

Sara

26/06/2009
10:51
Avatar
bujinwang
Member
Members
Forum Posts: 12
Member Since:
17/06/2009
sp_UserOfflineSmall Offline

Thanks Sara. That resolved my problem.

Regards,

Burt

17/07/2009
00:47
Avatar
koyyada
Member
Members
Forum Posts: 4
Member Since:
04/07/2009
sp_UserOfflineSmall Offline

Hello,

You are given methodCall in url , is it method in url ,if so it is not working, can u help me plz.

sree

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
68 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information