小编jua*_*tto的帖子

Bootstrap x-editable.以编程方式更改数据类型(删除select2数据类型)

我是,使用bootstrap x-editable https://vitalets.github.io/x-editable/index.html

这是我的HTML代码:

<a href="#" data-name="category" class="addon" data-value="{{$cat->id}}"
   data-pk="{{$cat->id}}" data-type="select2" data-title="Favor llenar los campos"></a>
Run Code Online (Sandbox Code Playgroud)

javascript代码:

$('.addon').editable({
    placement: 'bottom',
    mode: 'inline',
    showbuttons: false,
    source: categories,
    select2: {
        width: 200
    },
    display: function (value) {
        var elem = $.grep(categories, function (o) {
            return o.id == value;
        });

        $(this).attr('data-value', value);
        $(this).parent().parent().find('.btnEdit').attr('href', '/wizard_product/' + product_id + '/category/' + value + '/edit');

        return $(this).text(elem[0].text);
    }
});
Run Code Online (Sandbox Code Playgroud)

但.我想在没有select2选项的情况下以编程方式更改为普通的x-editable元素.

我已尝试使用jquery将a元素的data-type属性更改为text,但它不起作用.

$('a.addon').attr('data-type', 'text');
Run Code Online (Sandbox Code Playgroud)

还尝试过:

$('a.addon').select2('destroy');
Run Code Online (Sandbox Code Playgroud)

还尝试过:

$('a.addon').editable({type: 'text'});
Run Code Online (Sandbox Code Playgroud)

但两种选择都不奏效.select2仍处于活动状态.如何删除x-editable的select2选项?你能帮我吗

javascript jquery x-editable select2

10
推荐指数
1
解决办法
1445
查看次数

如何从postgreSQL中的时间戳中减去/添加分钟

我有以下场景:

我有员工在工作中登记入住/退房.但他们有10分钟的容忍度.

我从这个观点得到的后期条目:

CREATE OR REPLACE VIEW employees_late_entries
(
  id,
  created_datetime,
  entry_datetime,
  contact_id,
  contact_name,
  user_id,
  employees_perm_id
)
AS 
 SELECT precence_records.id,
    precence_records.created AS created_datetime,
    ("substring"(precence_records.created::text, 0, 11) || ' '::text) || contacts.entry_time::text AS entry_datetime,
    contacts.id AS contact_id,
    contacts.name AS contact_name,
    precence_records.user_id,
    precence_records.employees_perm_id
   FROM precence_records,
    contacts
  WHERE 
    precence_records.type::text = 'entry'::text AND 
    contacts.employee = true AND 
    contacts.id = precence_records.contact_id AND 
    ( ("substring"(precence_records.created::text, 0, 11) || ' '::text) || contacts.entry_time::text) < precence_records.created::text AND 
    precence_records.employees_perm_id IS NULL;
Run Code Online (Sandbox Code Playgroud)

precence_records.created是时候检查和contacts.entry_time时间表输入时间为员工的时间.

这是获得迟到条目的condition contacts.entry_time …

sql postgresql

7
推荐指数
1
解决办法
1万
查看次数

Laravel 5.4 - 如何更改 Laravel 日志文件名?

Laravel 版本:5.4.25 PHP 版本:7.0

在 Laravel 的早期版本中,有一个ConfigureLogging 类来执行此操作。但在 Laravel 的最新版本中,该类被删除,而是有一个新的 LogServiceProvider:

protected function configureDailyHandler(Application $app, Writer $log)
{

    $log->useDailyFiles(
        $app->storagePath() . '/logs/customLogName.log',
        $app->make('config')->get('app.log_max_files', 5)
    );
}
Run Code Online (Sandbox Code Playgroud)

我想重写这个方法。

我怎样才能做到这一点 ?

请帮忙。

谢谢。

php-7 laravel-5.4

5
推荐指数
1
解决办法
7324
查看次数

这个选择器在jquery中做了什么?

这个选择器在jquery中做了什么:

$('tr[parents*=x'+1111014+'x]');
Run Code Online (Sandbox Code Playgroud)

谢谢

jquery

3
推荐指数
2
解决办法
95
查看次数

获取第一个与Jquery匹配条件的元素

我有此表,如何获取具有.cep类的第一个前任并通过Jquery获取此元素?

这是我的桌子:

<table>
    <tr class="cep"></tr>
    <tr class="ptype"></tr>
    <tr class="item"></tr>
    <tr class="cep"></tr> (I want to get this element)
    <tr class="ptype"></tr>
    <tr class="item"></tr>
    <tr class="item-here"></tr> (I'me here)
    <tr class="item"></tr>
</table>
Run Code Online (Sandbox Code Playgroud)

有没有办法做到这一点:

$('tr.item-here').prevUntilFindThefirstMatchOf('tr.cep'); Get this element
Run Code Online (Sandbox Code Playgroud)

请帮忙

javascript jquery dom

2
推荐指数
1
解决办法
2546
查看次数

从postgres中的now()函数获取时间

我有一个存储功能。

我只想从now()Postgres中的功能获取时间。我该怎么做?

我知道您可以使用该日期DATE(now()),但是我尝试使用的时间TIME(now())却无效。

sql postgresql time

2
推荐指数
1
解决办法
1451
查看次数

stream_socket_sendto():连接被拒绝。Laravel 5.7转储服务器

我正在使用Laravel。当我dd($ request-> all())时,其中的数据涉及文件(.mp3文件)。它返回错误:

[2019-03-16 15:44:12] local.ERROR: stream_socket_sendto(): Connection refused {"exception":"[object] (RuntimeException(code: 0): stream_socket_sendto(): Connection refused at /vendor/symfony/var-dumper/Server/Connection.php:63 
Run Code Online (Sandbox Code Playgroud)

php-fpm可能有问题吗?如果我运行php artisan服务,则不会发生这种情况;如果运行php artisan转储服务器,也不会发生这种情况。

有任何想法吗??

nginx laravel php-7.2 laravel-5.7

2
推荐指数
1
解决办法
1810
查看次数

获取与PHP中的特定值匹配的多维数组的所有键

我有这个数组:

$transfers =
    Array
    (
        [0] => Array
            (
                [agency_to_id] => 8
                [agency_name] => 3.1 SUCURSAL BRASILIA
                [product_id] => 415
                [product_code] => 111021
                [product_name] => PAN FELIPE POR KILO
                [ptype_id] => 54
                [ptype_name] => 1.1.01.1 PANADERIA X KILO
                [catalog_id] => 1
                [subject_id] => 3
                [label_id] => 300000002
                [total_quantity] => 12
            )

        [1] => Array
            (
                [agency_to_id] => 9
                [agency_name] => 4.1 SUCURSAL CENTRO
                [product_id] => 415
                [product_code] => 111021
                [product_name] => PAN FELIPE POR KILO
                [ptype_id] => 54
                [ptype_name] => …
Run Code Online (Sandbox Code Playgroud)

php arrays

1
推荐指数
1
解决办法
78
查看次数

具有现有数据库的 Django 模型

我是 Django 的新手,我有一个项目,我想使用 postgres 中现有的数据库,其中包含 400 多个表。但我已经阅读了 django 文档,并且总是必须定义这样的模型:

from django.db import models

class Person(models.Model):
    first_name = models.CharField(max_length=30)
    last_name = models.CharField(max_length=30)
Run Code Online (Sandbox Code Playgroud)

但我不想对 400s 表执行此步骤。有没有办法只放置表之间的关系而不进行每个模型的定义和迁移?像 laravel 这样的东西:

class User extends Model
{
    /**
     * The roles that belong to the user.
     */
    public function roles()
    {
        return $this->belongsToMany('App\Role');
    }
}
Run Code Online (Sandbox Code Playgroud)

你能帮我吗??

谢谢

django postgresql django-models

1
推荐指数
1
解决办法
1985
查看次数