⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Problem with Page Drop Down List in Table



fastturtle
  • profile picture
  • Member

Posted 19 April 2012 - 21:59 PM

I am a newbie to using codeigniter and grocery CRUD. Grocery CRUD looks great so I tried to implement a Grocery CRUD table into my existing website. My website is currently using a theme that I purchased and it has a real nice menu system. Well this menu system uses a juery plugin to collapse and expand the menu. There is a function in the jquery plugin that has the following line of code:


return $(this).each(function() {


Whenever I add a Grocery CRUD table the drop down select list does not work properly. I isolated the problem to this line of code. If I comment out this line of code the CRUD table works fine, but the menu of course does not work now.
Any ideas would be greatly appreciated. I would really like to use both my theme and the Grocery CRUD. Thanks in advance.

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 20 April 2012 - 04:39 AM

Can you please be more specific? What menu did you use? Or if it is something custom can you post the code here?

The

return $(this).each(function() {
say nothing to me because with this you just inactivate your plugin, nothing more.

fastturtle
  • profile picture
  • Member

Posted 20 April 2012 - 14:02 PM

Sorry I will try and be more specific. I included the grocery crud example employees table (with the flexgrid css) into an existing website that has a simple menu that uses a jquery function that expands and collapses the menu. The grocery crud table works great except the pull down select list that lists the number of records to be shown on the page (10, 20, etc) does not work. I found that if I comment out the juery function that has the code

[color="#000000"]each[/color][color="#666600"]([/color][color="#000088"]function[/color][color="#666600"]()[/color]

[color="#666600"]everything works fine.[/color]
[color="#666600"]So for some reason when I use the jquery command [color="#000000"]each[/color][color="#666600"]([/color][color="#000088"]function[/color][color="#666600"]()[/color] it blows up the select list.[/color]

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 20 April 2012 - 20:58 PM

Can you at least have a printscreen if you don't mind or/and have the whole code of the javascript that you believe that causes the problem so I don't want just the line. I am trying to help you but I really can't understand.

For me it will be great to have: [list]
[*]a printscreen of your situation (I have worked with lot of templates such as simpla admin, white-label theme and I had similar issues)
[*]all the javascript that you believe that causes the problem
[*]and perhaps your firebug errors if any.
[/list]
If you don't want to publish the print-screen just send it to me as a private message.

fastturtle
  • profile picture
  • Member

Posted 20 April 2012 - 23:38 PM

This is the jquery that causes the problem:


jQuery.fn.initMenu = function() {
return $(this).each(function() {
var $menu = $(this);

// Set the container's height
$menu.find('.sub').show();
$menu.parent().height($menu.height() + 10);
$menu.find('.sub').hide();
// Append arrow to submenu items
$menu.find('li:has(ul)').each(function() {
$(this).children('a').append("<span class='arrow'>&raquo;</span>");
});
$menu.find('.sub').hide();

// The main part
$menu.find('li a').click(function(e) {
e.stopImmediatePropagation();
var $submenu = $(this).next(), $this = $(this);

if($menu.hasClass('noaccordion')) {
if($submenu.length == 0) {
window.location.href = this.href;
}
$submenu.slideToggle('normal');
return false;
} else {
// Using accordeon
if($submenu.hasClass('sub') && $submenu.is(':visible')) {
// If already visible, slide up
if($menu.hasClass('collapsible')) {
$menu.find('.sub:visible').slideUp('normal');
return false;
}
return false;
} else if($submenu.hasClass('sub') && !$submenu.is(':visible')) {
// If not visible, slide down
$menu.find('.sub:visible').slideUp('normal');
$submenu.slideDown('normal');
return false;
}
}
});
});
};


The each(function() causes the page drop down select menu with a grocery crud table to not work at all. Any ideas forum. No firebug errors.