我试图找到并设置页面上许多选择框的第一个选项.
$('ul#mygroup li select').each(function () {
$(this +' option:nth-child(0)').attr('selected', 'selected');
});
Run Code Online (Sandbox Code Playgroud)
第二行是失败的地方.我似乎无法定位组中每个选择框的第一个选项.
我从Git 下载了Kohana Pagination模块,并且在尝试使用它时遇到了一些问题.
我将它移动到modules文件夹并更新了我的bootstrap以包含模块...'pagination'=> MODPATH.'kohana-pagination',
我有以下代码从分页的简单表中加载一些消息...
public function action_index()
{
$content = View::factory('welcome')
->bind('messages', $messages)
->bind('pager_links', $pager_links);
$message = new Model_Message;
$message_count = $message->count_all();
$pagination = Pagination::factory(array(
'total_items' => $message_count,
'items_per_page' => 3,
));
$pager_links = $pagination->render();
$messages = $message->get_all($pagination->items_per_page, $pagination->offset);
$this->template->content = $content;
}
Run Code Online (Sandbox Code Playgroud)
当我在浏览器中运行加载时,我收到以下错误消息...
ErrorException [ Fatal Error ]: 1Call to undefined method Kohana::config()
MODPATH\kohana-pagination\classes\kohana\pagination.php [ 87 ]
82 * @return array config settings
83 */
84 public function config_group($group = 'default')
85 {
86 // …Run Code Online (Sandbox Code Playgroud)