Current jQuery (v1.8.3) doesn't like arrays in column names

QuestionsCurrent jQuery (v1.8.3) doesn't like arrays in column names
Jiri Vidgren asked 11 years ago

Hi,

I have column names like:

$col["name"] = "server_capacity['cpu']";
$col["name"] = "server_capacity['mem']";
$col["name"] = "server_capacity['disk']";

And those are working quite nicely. I have server_capacity array inside POST -data, which I can use. But the problem arises, when I try to show/hide those columns on add/edit view, via:

$col["show"] = array("add"=>true, "edit"=>false);

This will result as: Error: Syntax error, unrecognized expression: #tr_server_capacity['cpu']

And no add/edit -form will open.

Any fix for this?

2 Answers
Abu Ghufran answered 11 years ago

Hello,

I think this is due to usage of [ ], which are used in jquery selector of attributes.
Alternate options is, if you want to hide TR #2, of grid id 'list1', this code should work.

$opt["edit_options"]["afterShowForm"] = "'jQuery("#TblGrid_list1 tr:eq(2).hide();'";

Jiri Vidgren answered 11 years ago

Thanks for your quick answer and valuable tip. Actually, I had to wrap that into function and this is how I hide all rows after 3:

$opt["edit_options"]["afterShowForm"] = "function(formid) { jQuery('#TblGrid_list1 tr:gt(3)').hide(); }"

Beautiful, thanks!

Your Answer

12 + 14 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?