I'm using an XTemplate to render rows in a dataview, and I can refer to the data in the current record by name:
xtype : 'dataview',
tpl : new Ext.XTemplate('<tpl for=\".\"><div>{cost}</div></tpl>')
this is fine, but I'd like to be able to refer to the previous record in the dataset, to do some switching based on whether the value is greater or less than in the previous record.
Is this possible, and if so, how? From the doco it would seem to be possible using xindex somehow?
Thanks,
the sibling can be referenced as:
tpl : new Ext.XTemplate('<tpl for=\".\"><div>{[parent[xindex].cost]}</div></tpl>')
Note that we do not decrement xindex, because it starts at 1, not 0
Related
I want to put YADCF filters as the first row in the table. Is there a config option for that? Currently, I have it as a part of header row.
I am able to put the filter in footer and use display:table-header-group to put it in the first row. However, this feature stops working when I use "scrollX": true to allow horizontal scrolling.
You can try the filters_tr_index
As to integration with vertical scrolling, I'm not sure if it works properly (in the past there was no option to integrate with that feature)
filters_tr_index -
Required: false
Type: integer
Default value: undefined
Description: Allow to control the index of the inside the thead of the table, e.g when one is used for headers/sort and
another is used for filters
If you specify the columnCfgs for a rallygrid using the string representation, you get some nice built in functionality for different columns - e.g. the FormattedID column has a link to the item when it is rendered. However, some of the fields have a default flex that makes them way longer than necessary (mostly the name) which makes the grid look a lot different than I want it to.
You can specify the name column as
{text: 'Name', dataIndex:'Name', flex: 1},
but is there a way to specify flex for columns that you declare using the format:
'Name'
?
This is a weirdness with the grid that we'd like to fix before the GA of SDK 2. In the meantime you can simply do the same thing the grid is doing to build those preconfigured columns:
var nameColumnConfig = Rally.ui.grid.FieldColumnFactory.getColumnConfigFromField(
model.getField('Name'), model);
nameColumnConfig.flex = 1;
Then simply pass that into the grid the same as you would the object literal above.
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);
In my Dojo application, I had a tree with nodes sorted by their name. Like this :
I already built a New form addition, and it can add a new node to this tree, but always at the bottom. Is there a way to insert this newly added node to the store in a correct sorted position? So if I am about to add 000-011 - Biaya Teknis Pengacara to this tree, it should be ended up this way :
To achieve this, currently I must refresh my browser. Surely, this is not what all user wanted.. :)
For the code addition of node itself, here it is:
//TOFIX : add in a sorted way
akunStore.newItem(
{"id":data.id.toString(),"name":data.name},
{"parent": groupsModel.root, "attribute":"groups"}
);
akunStore.save();
akunStore.fetch();
I add the fetch() as shown above, but it didn't work, currently.
Use the sort attribute in your call to the fetch() method of your data store. Try something like :
akunStore.fetch({
sort: [
{ attribute: "youFirstSortField" },
{ attribute: "aSecondSortField" }
]
});
You can also specify a descending order by adding "descending : true" in your sort params... more on that here : http://dojotoolkit.org/reference-guide/quickstart/data/usingdatastores/sorting.html#quickstart-data-usingdatastores-sorting
I am trying to add a row to a slick grid on my page using javascript. The way I am able to do it now is by using the following code. I was just wondering if there was a better way to do the same.
....
//data is the array which was used to populate the SlickGrid
data.push({name:'Finish scanning the slickgrid js', complete:false});
grid.setData(data);
grid.render();
....
This is the preferred way.
data.push({...});
grid.updateRowCount();
grid.render();
Calling .setData() forced the grid to re-render everything. By calling updateRowCount() you are notifying the grid the number of the rows have changed and that it needs to render what has been added or removed only.
Here is what I've been used for adding new row with Button
function add_new_row(){
item = {"id": (Math.round(Math.random()*-10000))
//you can add another fields to fill default data on Adding new row
};
data_view.insertItem(0, item);
}