GithubHelp home page GithubHelp logo

Comments (9)

unclead avatar unclead commented on July 20, 2024

Currently the main idea is that has to be at least one row in list. Your case can be solved the next way:

  • add new property e.g. enableEmptyList
  • if this property is true widget will render add button in the header of table

New property is necessary for BC. I will try to implement this feature soon or you can prepare PR.

from yii2-multiple-input.

unclead avatar unclead commented on July 20, 2024

Implemented via dd0d61d
You can update to last revision
Let me know if this is what you wanted

from yii2-multiple-input.

lorinczelod avatar lorinczelod commented on July 20, 2024

ok, but the + signed wanised... at least in MultipleInput example... with new allowEmptyList property
this example not working

echo $form->field($model, 'emails')->widget(MultipleInput::className(), [
    'limit' => 5,
    'allowEmptyList' => true,
])

My quick fix:

    protected function guessColumns()
    {
        if (empty($this->columns) && $this->hasModel()) {
            $this->columns = [
                [
                    'name' => $this->attribute,
                    'type' => MultipleInputColumn::TYPE_TEXT_INPUT,
                    'title' => Inflector::camel2words($this->attribute), // THIS line
                ]
            ];
        }
    }

... but this should working without 'title', too

from yii2-multiple-input.

unclead avatar unclead commented on July 20, 2024

Ohhh yes, i forgot about this case

from yii2-multiple-input.

unclead avatar unclead commented on July 20, 2024

fixed via f96092c

from yii2-multiple-input.

lorinczelod avatar lorinczelod commented on July 20, 2024

Great solution, but the 'title' question isn't solved.
The '+' sign staying there alone, without title, I can't find the proper solution unless the one below.
Probably we need a new property to turn on/off the title and for BC.
(I think we need a title when 'allowEmptyList' is true...)

    protected function guessColumns()
    {
        if (empty($this->columns) && $this->hasModel()) {
            $this->columns = [
                [
                    'name' => $this->attribute,
                    'type' => MultipleInputColumn::TYPE_TEXT_INPUT,
                    'title' =>$this->model->getAttributeLabel($this->attribute), // recommended line
                ]
            ];
        }
    }
    ```

from yii2-multiple-input.

unclead avatar unclead commented on July 20, 2024

Give me an example of code which does not work.
Here is the example without title

<?php
    echo $form->field($model, 'emails')->widget(MultipleInput::className(), [
        'limit' => 5,
        'allowEmptyList' => true
    ])
    ->label(false);
?>

http://prntscr.com/8gliiw

from yii2-multiple-input.

unclead avatar unclead commented on July 20, 2024

It seems that I understood that you propose 😄

But this is another issue. Look at #35

from yii2-multiple-input.

lorinczelod avatar lorinczelod commented on July 20, 2024

thank you :)

2015-09-15 19:31 GMT+03:00 Eugene Tupikov [email protected]:

It seems that I understood that you propose [image: 😄]

But this is another issue. Look at #35
#35


Reply to this email directly or view it on GitHub
#34 (comment)
.

from yii2-multiple-input.

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.