Giter Site home page Giter Site logo

Comments (8)

ihorchepurnyi avatar ihorchepurnyi commented on May 23, 2024

Hi, please describe in more details the issue

from yii2-comments.

ihorchepurnyi avatar ihorchepurnyi commented on May 23, 2024

Your model must have a primary key column, by default widget used the id attribute from your model. If the primary key in your model has another name, then you can change the name of entityIdAttribute by the following code:

<?php echo \yii2mod\comments\widgets\Comment::widget([
    'model' => $model,
    'entityIdAttribute' => 'name of primary key attribute from your model'
]); ?>

from yii2-comments.

dzas42 avatar dzas42 commented on May 23, 2024

that is work but button delete and replay is not work and pjax is not working
![Uploading error.png…]()
in firebug error
TypeError: jQuery(...).comment is not a function
jQuery('#comment-form').comment({"pjaxContainerId":"#","formSelector":"#comment-...

from yii2-comments.

ihorchepurnyi avatar ihorchepurnyi commented on May 23, 2024

How i can reproduce it? Can you add your code with model and widget setup here?

from yii2-comments.

ihorchepurnyi avatar ihorchepurnyi commented on May 23, 2024

Now i try the following code and the reply and delete functionality works perfectly.

$model = CmsModel::findOne(1);

<?php echo Comment::widget([
            'model' => $model,
            'entityIdAttribute' => 'idkey'
        ]); ?>

from yii2-comments.

dzas42 avatar dzas42 commented on May 23, 2024

// in view

$model, 'entityIdAttribute' => 'id' //'entity'=>'test', // 'entityId'=>1, ]); // in model $model = \yii2mod\comments\models\CommentModel::findOne(1); but this is same error,,,

from yii2-comments.

ihorchepurnyi avatar ihorchepurnyi commented on May 23, 2024

$model is an entity to which a comment is added. For example Post, Cms, etc..

from yii2-comments.

ihorchepurnyi avatar ihorchepurnyi commented on May 23, 2024

For example, if you want to add the comments to the some post you can try the following code:

$model = Post::find()->where(['title' => 'some post title'])->one();
 // and just put your model to the widget.
<?php echo \yii2mod\comments\widgets\Comment::widget([
        'model' => $model,
 ]);

from yii2-comments.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.