jQWidgets Forums

jQuery UI Widgets Forums Layouts Kanban Kanban method "addItem"

This topic contains 4 replies, has 2 voices, and was last updated by  dario 8 years, 5 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • Kanban method "addItem" #88307

    dario
    Participant

    Hi,
    as I can set a value for the field “id” of a new item in a Kanban, using the “addItem” method?
    Thank you.
    Dario

    Kanban method "addItem" #88328

    ivailo
    Participant

    Hi Dario,

    Yo have to add “id” field in the object, used to create the new item.
    If you don’t add such a field it’s set automatically.

    Best Regards,
    Ivailo Ivanov

    jQWidgets Team
    http://www.jqwidgets.com

    Kanban method "addItem" #88342

    dario
    Participant

    Thanks for reply, ivallo.
    I had thought the same thing, but it does not work.

    Here is the code:
    $(‘#kanban’).jqxKanban(‘addItem’,
    {
    id : “IDvalue”,
    status : “other values…”,
    text : “other values…”,
    tags : “other values…”,
    color : “other values…”,
    resourceId : number
    });

    When I try to retrieve the id value I get the number set automatically by the control.
    In fact the help of “addItem” method does not indicate “id” between the possible values.

    Where am I wrong?
    Thanks in advance.

    Kanban method "addItem" #88372

    ivailo
    Participant

    Hi Dario,

    Please, refer to this demo of kanban with “addItem” method.
    Here is set the id without any problems.
    If you don’t set the id, it will be set automatically.

    Best Regards,
    Ivailo Ivanov

    jQWidgets Team
    http://www.jqwidgets.com

    Kanban method "addItem" #88480

    dario
    Participant

    Hi ivallo, thanks for reply.
    I show you what is my problem, which manifests itself even in the code you posted.
    Please add the event “itemAttrClicked” to the code, as shown below (and also rem the other console.log line, for clarity).
    It shows the value of the id property of the clicked element.

    Well, clicking on the first item appears correctly “1161”.
    After pressing “AddItem”, if you clicking on the new item, the “id” property returns an error.
    But I would like it contained the new id immediately set.
    I hope I was clear.

     
        $('#kanban').jqxKanban({
            ...
        })
        .on("itemAttrClicked", function (event) {
            console.log(JSON.stringify(event.args.item.id));
        });
    
    

    Thanks in advance for your help.
    Dario

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.