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
formatter:'actions', onEdit: setColProp
21/05/2013
13:00
Avatar
dofamin
New Member
Members
Forum Posts: 2
Member Since:
21/05/2013
sp_UserOfflineSmall Offline

Hello,

Sorry for my english.

I have formatter:'actions',

and there is

onEdit: function (rowid) {
                                var cellvalue = $(this).getCell(rowid,'Network_ID'); // I get here valus which needs as parameter below

                                var link = '<?php echo $base_url.'index.php/hosts/getListOfHosts/';?>'+cellvalue+'';

                                $(this).setColProp('Parent_Host', {

                                    editoptions:{

                                       dataUrl: link

                                    }
                                 
                                }); //setColProp ends

                              } //onEdit end

I will try to describe in my awful english -

when I click on the edit button, I am getting a list ( index.php/hosts/getListOfHosts -> doing a list with parameter cellvalue that contained in hidden column Network_ID)

and at the first click this list does not appear at the Parent_Host column (in the SetColProp)

at the second click on another line the list shows up in the with Parent_Host column with the valid cell value (from hidden column Network_ID) 

and clicking further below the grid lines on edit buttons, all Parent_Host are having each lists and all is ok

but when I've got the line where the cell value (from hidden column Network_ID) another e.g. 2 instead of 1 like in previous grid lines (assume I have cellvalue = 1 from 1st -> 15th and from 16th I have cellvalue = 2) then obviously I must get 'index.php/hosts/getListOfHosts/' with parameter 2, but I am getting previous parameter 1, and such a thing happenes

e.g. if I click the edit on line with Network_ID = 3, then I click the edit on line with Network_ID = 6, I will got the list  1st time empty (cuz at the first click this list does not appear) and 2nd list will be with parameter 3 but real has to be 6.

Do you get me?

Apologies again for bad English.

Also I have to pass this cellvalue parameter (Network_ID) to the editUrl which is out of the namespace of the onEdit formatoptions of the formatter action.

Please kindly help me.

Thank you!  

Cry

formatoptions
22/05/2013
14:46
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

The way way you try to do this will not work.

The onEdit function is executed after all server processes are executed including getting the select via dataUrl.

Will see how to help if I understand right the problem.

Regards

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.

22/05/2013
16:12
Avatar
dofamin
New Member
Members
Forum Posts: 2
Member Since:
21/05/2013
sp_UserOfflineSmall Offline

Hello Tony,

appreciate you answered.

Look what is the issue in my case:

  • I'm creating Grid that contains some columns, from them I have columns Parent Host and Network_ID

                        $('#statistics').jqGrid({
                        url:'<?php echo $base_url.'index.php/jqgrid/statisticsHostFreeGrid/';?>',
                        datatype: 'json',
                        mtype: 'post',
                        colNames:['','Parent Host', 'Network_ID'],
                        colModel: [
                            {name:'Actions',
                                width:50,
                                formatter:'actions',
                                formatoptions:{
                                  editbutton: true,

                                  onEdit: function (rowid) {
                                    var cellvalue = $(this).getCell(rowid,'Network_ID');
                                    $(this).setColProp('Parent_Host', {

                                        editoptions:{
                                           dataUrl: '<?php echo $base_url.'index.php/hosts/getListOfHosts/';?>'+cellvalue+'';
                                        }
                                     
                                    }); //setColProp ends

                                  } //onEdit end
                                  
                                },

                            {name:'Parent_Host',
                                index:'Parent_Host',
                                width:100,
                                key:true,
                                editable:true,
                                edittype:'select'

                            },

                            {name:'Network_ID',
                                index:'Network_ID',
                                editable:false,
                                width:100,
                                key:true,
                                hidden: true
                            }
                    ],//colModel

                pager: '#statisticsPager',
                rowNum:100,
                rowList:[10,20,30,100],
                sortname: 'Host_ID',
                sortorder: 'asc',
                viewrecords: true,
                height:230,
                width:'100%',
                gridview: true,
                editurl:'<?php echo $base_url.'index.php/jqgrid/hostsGridEdit/';?>'+?????+''

  • I need to set parameter to the Parent_Host dataUrl option, I decided to do that via onEdit in the formatter actions via setColProp because I need to know the rowid to use getCell(rowid,'Network_ID');
    But this is not working good and you said this won't work at all
  • Also I need to set this parameter to editurl (where ???? question marks typed in)

So, I need to create a select list for column Parent Host vis some function but this function needs extra parameter - this parameter is in the hidden column Network_ID , and I need to retrieve it from Network_ID and put to the Parent Host dataUrl and also I need it in the editurl .

Is it a bit cleaner now to understand?

Thank you for your help.

Regards.

23/05/2013
11:05
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

I think I understand what you mean.

Short.

In the offical release this can not be done.

I have made some fixes which are in GitHub.

The simple solution is to dive you a possibiltiy to define the dataUrl as function.

With other words you will needf to use the code from GitHub.

In order to do this you can do something like this:

{name:'Parent_Host',
         index:'Parent_Host',
         width:100,
         key:true,
         editable:true,
         edittype:'select',

         editoptions : {

                dataUrl : function( rowid, value, name) {

                    var cellvalue = $(this).getCell(rowid,'Network_ID');

                    return '<?php echo $base_url.'index.php/hosts/getListOfHosts/';?>' +cellvalue;

                }

         }

}

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.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
32 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