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_Related Related Topics sp_TopicIcon
problem with custom element
03/09/2012
15:26
Avatar
alexspb
Member
Members
Forum Posts: 10
Member Since:
17/08/2012
sp_UserOfflineSmall Offline

Hello

I do:

<script>
function myelem (value, options) {
  var el = document.createElement("input");
  el.type="text";
  el.value = value;
  return el;
}
 
function myvalue(elem, operation, value) {
    if(operation === 'get') {
       return $(elem).find("input").val();
    } else if(operation === 'set') {
       $('input',elem).val(value);
    }
}
jQuery("#grid_id").jqGrid({
...
   colModel: [ 
      ... 
      {name:'price', ..., editable:true, edittype:'custom', editoptions:{custom_element: myelem, custom_value:myvalue} },
      ...
   ]
...
});
</script>
Result: Error e1. How i can do custom element?
19/09/2012
13:17
Avatar
alexspb
Member
Members
Forum Posts: 10
Member Since:
17/08/2012
sp_UserOfflineSmall Offline

i find solution. My problem appeared because i generate model in php as array and passed in javascript json_encode. javascript don't determine that myelem is function.

jquery.jqGrid.src.js line 5914:

if($.isFunction(options.custom_element)) {.....

my solution:

lines 5913-5926 (block "try") replace to:

try { var celm = window[options.custom_element]($t,vl,options); celm = $(celm).addClass("customelement").attr({id:options.id,name:options.name}); $(elem).empty().append(celm); }

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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