This is the easiest way so far. doesn't account for situation when the rownumbers option of the gris is set to false;
parseInt($(“#”+ id +” >td:first:first”,ts.jqCtrl).html());
Hope this could help somebody.
Yes in cell edit too! And same thing with the 'set' i would believe!
First option seems to work.
I'll check the other tomorrow. Thanks again!
Thanks Mark will try the recreate form. Got it set but not on the edit parameter of the edit button (pencil);
Otherwise, I don't know if i could set that parameter in my php jGrid class. Will give it a shot!
Good explanation Mark, thank you!
I guess yes in one scenario, one could wrap everything inside it's own span.
Good for me! I'll take that!
Thanks again
Regards,
Ok, how can i say this again: I AGREE WITH BOTH OF YOU!!!!
I'm just saying that the provided solution could be made EVEN MORE FLEXIBLE, as stated in POST 4 and in POST 6,
Mark, that was just a quick fix. I totally agree with you on the fact that the custom element could be whatever we want, even further, it could be more than one control. See post 4!
I said in the post 4 that i would recommend to simply put the “.customelement” class flag on the tag that surrounds the custom control.
Maybe the span should be sent to the custom_value on a “get”. Then, you can work with whatever is inside that span and return the appropriate value.
All in all, that was a good catch from you. The “input” is way to much strict.
Regards,
If someone wants to have a custom element with multiple input or whatever, this might not work properly.
Ok, i got it to work. Assuming we want to keep the span surrounding the customelement…. which i think is good!
In grid.formedit.js around line 543
Replace
if($(this).hasClass("customelement")) {
That's not a good fix.
Maybe the “customelement” class should be set on the span element
Sounds great when you say:
“
So, in other words, apart from the naming convention (and the bug!), everything is supposed to work the way we both want anyway…
“
Unfortunately, it is late and I'm not sure I understand your explanation on how custom_element and custom_value are called and used.
I'll read again tomorrow ![]()
To make things less confusing, lets redefined the 3 functions again:
custom_element: create the input element;
custom_format: format the data for the custom_element value
custom_value: unformat or else the custom_element value to be sent to the server
Mark, the only reason that i want to add the *new* custom_value is in this situation (for example).
I have a field stored in numeric in my database that represent a duration in seconds. In the grid, I use the custom format and unformat to convert this value into “hh:mm:ss”.
Right now, when i create the form (the first time), i get the unformatted value for example “120″ that i transform again to “00:02:00″ (2 minutes) for my input field value. Then, after i created my input control, i can associate a time picker using, for example, $().timepicker().
If filldata doesn't recreate the input control, then the next time i open the edit form, I assume that i will see “120″.
Now with the new functions,
custom_value*: change “120″ to “00:02:00″ and if custom_value doesn't exist, it would simply display the unformatted value taken from $.fn.***.unformat
custom_postvalue: change back “00:02:01″ to “121″ to send back to the server.
Regards
Thanks Mark,
Concerning the data that is not posted, I think i've found the source of the problem:
In file grid.formedit.js around line 543. you will find the following:
if($(this).hasClass(“customelement”))
In that situation, $(this) is in fact the container of the input element => <input…
Therefore it will never have the class customElement.
Solution:
Change $(this) to $(this).children(“input”)[0]
Well, there might be a better way to get the the first child of the span element. I will be please to learn that!!!!
Regards,
Tony, the jqgrid_LoadData(pdata) is pretty much the same as in the datatype function example.
The reason is that i also load the properties of the grid through an AJAX call. To make a longer strory shorter, i was trying to use JSON.parse and the function wouldn't execute. After looking around i came to realise that JSON.parse was not going to work at all and went back to eval without changing what i had already did.
Thanks for your post.
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top