Add id to sencha nested list items - sencha-touch-2

I have a sencha nested list that contains some elements from a store. I need to customize each element separately so I need to set a custom id to each. Can I achieve that in sencha touch 2 ?

The simplest way is to generate/populate the unique id in the store and then use the itemTpl to render the id out.
itemTpl: "<div id =\"{id}\" class=\"list-item-title\">{name}</div>"

Related

How can I have multiple instances of same dojo form element with same id in a page?

I have a page say profile.htm with dojo declarative form with id="myForm". I have another page say dashboard.htm having border layout with 3 content pane. I want to show the profile.htm in all these three contentPanes. But when I try this then it gives registration error because there will be three forms with same Id.
Is there any solution for this so that I can have same page (with same id) in many contentPanes?
You simply can't, it's because of the HTML spec:
The id global attribute defines a unique identifier (ID) which must be unique in the whole document.
See: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
The same goes for dijit's, if there are many dijit's with the ID myDijit what would registry.byId('myDijit') return? Dijit has it's own method of assigning unique ID's just as long as you don't assign one.

Sencha Touch 2: Give a different itemTpl to nested list leaf nodes

In my nested list I have 2 levels. Currently it shows a standard list. When you click an item it takes you to a list of that item's children. Those children are the leaf nodes. So when you tap one of those it takes you to the detail card for that item. I'd like to use a different list item template for the children than the parent items. Is there a way to use Ext.XTemplate to check if an item is a leaf node or not?
Figured it out:
Simply update the x-list-item-leaf class
.x-list-item-leaf{
color:red !important;
}

Yii booster: how to render a cgridview inside a relation table row?

I'm using boostrap library on Yii via yii-booster
I've created a relation table view
The related view is a TbGriView itself
Vhen in a row i click on the link on the 'related' column, the row expands itself, and render a TbGridview inside it.
The problem is that the internal gridview cannot be sorte, paged or filtered, because each action on it causes that the entire container grid will empty
Note
- external grid as a id of 'extenalgrid'
- each internal grid has as id like 'internalgrid-$rowId' , so every internal grid as differnt id on div, table and table row elements.
- the action called from "render related tabel" link is using renderPartial without the postProcess option. If i use potProcess, the row will be empty
So is it not possible to rendere a full working gridview/tbgridview into a related table ?
Use different css classes for the filters, buttons and headers for the different tables. From the jquery.yiigridview.js file events are bound to selectors as $('#table-id .selector-class') so elements in your internal gridView still trigger the events bound to the external gridView. You also have to specify a different url for the internal gridView by setting it's ajaxUrl.

Sencha Touch 2: Insert into TreeStore/NestedList

I'm using a NestedList with a underlying TreeStore. Now I want to add items to the NestedList as leafs.
How can I do this?
Currently my code (Controller, onAddButtonTapped) looks like this:
var store = Ext.getStore('menuStore');
var customerAreaNode = store.getRoot().getChildAt(1);
customerAreaNode.appendChild({name: "text", leaf:true});
customerAreaNode.expand();
store.sync();
This code results in two new empty listentries on leaf level (behind the correct node) and one new listentry on node level.
Every new entry has no names shown in the NestedList but every item contains "text" in their name field. Curiously one of the new entries at leaf level is not typed to the underlying Model. So the model-corresponding methods could't be found:
Uncaught TypeError: Cannot call method 'getSelectedName' of undefined
Does anybody know a easy tutorial how to add data into NestedList/TreeStore? I could not find one good example in the sencha touch docs.
The default display field for leaf items is "text". You can get the information from here. If you want to use "text" as display field, then you need to change this line to
customerAreaNode.appendChild({text: "text", leaf:true});
Or you can change your nested list's display field, so your model do not need to change for this time.
yournestedlist.setDisplayField('name');
Hope this helps.
In my case i used to update root and child nodes like the following way
Ext.getStore('Contactsstore').getAt(1).getChildAt(0).set('Email',contactemail);
Ext.getStore('Contactsstore').getAt(1).set('ContactTitle',contacttitle);

how to get id of fieldset

my question is similar to Extjs 4 How to get id of parent Component?.
But i am looking solution for it. As the answer given in the question doesn't seems to be useful
In my case i m having button in my each fieldset and also i m creating these fieldsets dynamically which contain button inside it.
Now on click event of button which is inside fieldset i want to get its corresponding fieldset id
This code will return parent fieldset:
button.up("[xtype='fieldset']")
Mahesh,
ACtully the problem in our case is , it is not extending the Ext.form.FieldSet.
So look this Extjs 4 How to get id of parent Component?
As Zango said, **button.up("[xtype='fieldset']")** will work for you.
Thanks,
Kunal