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 combo to a field in Edit Form
22/10/2008
02:36
Avatar
Prathap MK
India
Member
Members
Forum Posts: 9
Member Since:
21/10/2008
sp_UserOfflineSmall Offline

Hii,

          How can i use data to be populated to a field of edittype: select, from database instead of using editoptions: {value: some values}. I cannot hardcode these value and has to populate from database. How can i do this?

         Since surl can be used only with filter grid, i cannot use that too.

          Thanks in advance.

Regards,
Prathap.

22/10/2008
02:49
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

I will try to add this in next release. For now you can use a combination of loadComplete event again with setColProp to add extra fields of the select dynamically.

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

15/11/2008
17:30
Avatar
Renso
PA
Member
Members
Forum Posts: 118
Member Since:
11/09/2008
sp_UserOfflineSmall Offline

Quite simply actually, I do it with all my selectables:

Do this before you define the jqGrid and make sure async is set to false.

    //get all products
    var products = $.ajax({url: $('#ajaxAllProductsUrl').val(), async: false, success: function(data, result) {if (!result) alert('Failure to retrieve the Products.');}}).responseText;

The define your grid:

    $(item)
        .jqGrid({  
            url: listURL,
            postData: {ContractId : $('fieldset#ContractDetails #ContractId').val()},
            datatype: "json",
            colNames:['Id', 'Product Name'],
            colModel:[
                {name:'Id',            index:'Id', sortable:true, editrules:{edithidden:false}},
                {name:'ProductName',   index:'ProductName', sortable:true, required:true, editable:true, edittype:"select", editoptions:{value:products}, editrules:{required:true}}],

You can also do it on the loadComplete event by using setColProp, which I do in some other cases as if you are going to have modal boxes for editing it will generate a runtime error if you do not have it set the following way:

loadComplete: function()    {$(item).setColProp('ProductName',{editoptions:{value:products}});

By the way "item" is the id of the grid. Hope this helps

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
37 Guest(s)

Currently Browsing this Page:
1 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