0

Error not Unique in ID space in a template

asked 2013-09-24 03:18:30 +0800

daovallec gravatar image daovallec
11 2

updated 2013-09-24 03:19:07 +0800

I have this View in ZK:

<zk>
    <style src="/widgets/grid/inline_row_editing/style.css" />
    <div apply="org.zkoss.bind.BindComposer"
         viewModel="@id('vm')     @init('com.gemalto.segmentation.viewModel.users.InplaceEditingViewModel')"
>

        <grid id="demoGrid"
              model="@load(vm.languageContributions) @template((vm.displayEdit and each.editingStatus) ? 'editable' : 'noneditable')">
            <auxhead>
                <auxheader colspan="4"
                           label="Create Users">
                    <hlayout>
                        <label />
                        <button label="create" 
                                onClick="@command('onAddNew', languageContributionStatus=each)" />
                        <checkbox checked="@bind(vm.displayEdit)"
                                  label="Enable Multiple Inline Row Editing">
                        </checkbox>
                    </hlayout>
                </auxheader>
            </auxhead>

            <columns>
                <column width="160px">Email</column>
                <column width="160px">Password</column>
                <column width="160px">Confirm-Password</column>
                <column width="160px">Role</column>
                <column width="160px">Mnos</column>
                <column width="110px" visible="@load(vm.displayEdit)">Edit</column>
                <column width="110px"     visible="@load(vm.displayEdit)">Remove</column>
            </columns>
            <template name="editable">
                <row>
                    <textbox
                        value="@load(each.languageContribution.email) 
@save(each.languageContribution.email, before='confirm')" />
                    <textbox
                        value="@load(each.languageContribution.password) 
@save(each.languageContribution.password, before='confirm')" />      
                    <textbox
                        value="@load(each.languageContribution.password) 
@save(each.languageContribution.confirmPass, before='confirm')" />  
                    <textbox
                        value="@load(each.languageContribution.role) 
@save(each.languageContribution.role, before='confirm')" />


                    <button id="MnoE" label="Mnos">
                        <attribute name="onClick"><![CDATA[
            if (!MnoEWin.isVisible())
                MnoEWin.setVisible(true);
             MnoEWin.doHighlighted();
        ]]></attribute>
                    </button>


                    <button
                        label="save"
                        onClick="@command('confirm', languageContributionStatus=each)" />
                    <button
                        label="cancel"
                        onClick="@command('changeEditableStatus2', languageContributionStatus=each)" />


                </row>
            </template>
            <template name="noneditable">
                <row>

                    <label value="@load(each.languageContribution.email)" />
                    <label value="@load(each.languageContribution.password)" />
                    <label value="@load(each.languageContribution.password)" />
                    <label value="@load(each.languageContribution.role)" />

                    <button id = "edita"
                        label="edit"
                        onClick="@command('changeEditableStatus', languageContributionStatus=each)" />
                    <button label="delete"
                                onClick="@command('onDelete', languageContributionStatus=each)" />

                </row>
            </template>

        </grid>
    </div>
</zk>

And i do not why in

<template name="noneditable">

I have only One button with id

    <button id = "editar"
                    label="edit"
                    onClick="@command('changeEditableStatus', languageContributionStatus=each)" />

I have an error: Not Unique in ID space [Page myYFM_] editar. If i have only one button with that id.

Somebody can help me?

delete flag offensive retag edit

Comments

id shud be unique within a container but u are here within template so u need to ensure your id is also incrementing, so link to auto incremented value or unique number. try to give some count or something in your model and use that in your button id.like id="button${each.count}" .

shraddhadixit89 ( 2014-10-06 12:45:03 +0800 )edit

Accept the answer if it resolved and marked it done

sjoshi ( 2014-10-07 11:40:51 +0800 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-09-24 05:57:57 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

Do one thing Please remove id of button and ZK would generate the id for this button If u will see you are going to loop and According to ZK two or more component do not contain same id and this button in loop and it will generate more than one time so you will get this exception because two button will rendered with same id editar

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2013-09-24 03:18:30 +0800

Seen: 102 times

Last updated: Oct 06 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More