I have a gridPanel based on EXT4. When I select a particular row, the row highlighting works based on the "id" given to the particular row. How do I change the default implementation to something to use like "rowId" instead of "id"
Where is this done? How do I make the change?
The idProperty is the config option in Ext.data.Model which defaults to 'id'. You can change it to 'rowid' in your Model. If you are specifying fields directly in your Store, you will have to define a Data Model to have this option.
References:
http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.data.Model-cfg-idProperty
http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.data.Store-cfg-fields
Related
I'm trialling HandsOnTable via the Vue wrapper to make a simple database editor. I can populate the table easily, however I now need to save changes back to the database.
If I use the afterChange() method hot will give me the changes in the cells that have changed, however I need to be able to associate those changes with a database id to send them back to the server. Any idea of how to do this, and also is it possible to get the changes associated with a row? Would it also be possible to do this without displaying the database id to the user in the table?
To answer your main question, you can associate metadatas to cells. So you can put your technical id in your first column for example or a hidden column (or whereever you want).
hot.setCellMeta(0, 0, 'myIdName', 'myIdValue');
where "hot" is your Handsontable instance. (documentation reference)
You can then access getCellMeta(0, 0).
Second question :
and also is it possible to get the changes associated with a row ?
You already are able to get the changes of specific rows by filter the changes in the afterChange hook. Taking the example from Handsontable documentation this is how you get the row :
new Handsontable(element, {
afterChange: (changes) => {
changes.forEach(([row, prop, oldValue, newValue]) => {
// Some logic...
});
}
})
As you can see changes is an array of change that contain row and col (prop).
Hope this helps.
i need to assign the value of an existing attribute to another attribute
i have this attribute "ntUserDomainId" on 389-LDAP and I need it to take its value dynamic from another attribute, for example, this one "sn=amr"
I guess that can be achieve with a server side custom plugin. But otherwise, I don't believe that you can do this out of the box with any LDAP server.
I have a ruby script that is trying to pull up some custom fields from Rally, the filter works just fine ( the filter contains one of the custom fields i want to pull up) but when I try to display it, it doesn't show up in the list (the value returned for all custom fields is blank, while appropriate values are returned for FormattedID, Name, Description).
Here's the link [link]http://pastebin.ubuntu.com/6124958/
Please see this post.
Do you fetch the fields?
What version of WS API are you using? If it is v2.0 is c_ prepended to the name of the field in the code?
How is the field spelled in your code and how that spelling compares to Name and Display Name of the field in UI?
There is another reason why custom fields might not appear (other than the versioning and 'c_' issues nickm mentioned). I just found this out after a ton of head banging. The Rally SDK's ui stuff will filter out all fields that are hidden (such as _ref, or other 'hidden' custom fields) so you cannot view them in your apps in grids, charts, etc. For example, when constructing a Rally.ui.grid.Grid, a class called Rally.ui.grid.ColumnBuilder is constructed and it executes a command on the columns of the chart that look like this:
_removeHiddenColumns: function (columns) {
return _.filter(columns, function (column) {
return !column.modelField || !column.modelField.hidden;
});
},
As you can see, if you try to display any fields that are hidden (like _ref for example) in a grid, the column gets removed. So, although you may be fetching the custom fields, they will not show up unless those fields are not 'hidden'.
I am attempting to assign a unique id to each table row in Yii's CGridView.
Preferably something like $data->id from the database table.
I have been unsuccessful at adding an id attribute to each rendered <tr>.
Any suggestions would be most appreciated.
CGridView have an option called 'rowHtmlOptionsExpression' , you can declare like the followings to assign row an id
'rowHtmlOptionsExpression' => 'array("id"=>$data->id)',
It's better than hacking into 'rowCssClassExpression'
Good luck !
Modern solution (since Yii 1.1.13)
This is now possible to do using the rowHtmlOptionsExpression attribute, which allows assigning arbitrary HTML attributes to each rendered table row. For example:
'rowHtmlOptionsExpression' => '["id" => $data->id]'
Original answer (earlier versions)
Not directly possible because CGridView does not support it, but there are a couple of straightforward solutions that you can try.
Subclass CGridView (good)
Simply create your own class MyGridView extends CGridView and override the renderTableRow method to spit out ids on every row. Have a look at the stock implementation, which does for the class attribute exactly what you 'd like to do for the id attribute.
Use a CSS class instead (not so good)
Speaking of class attributes, the rowCssClassExpression property can be used to dynamically generate classes out of the box. IMHO this is a bad workaround, but it's there.
You could extend CGridView to add that functionality.
or be a bit hacky with rowCssClassExpression.
'rowCssClassExpression' => '\'" data-id="\' . $data->rowID'
Try the information I posted here:
How to set key value in CGrideView when grid is populated from table-view
In essence, as long as your dataprovider to the CGridview provides the data->id in a form that it understands, it will auto handle the $data->id stuff for you automatically so that it's easily available to javascript.
CGridView.rowHtmlOptionsExpression is undefined
I don't think that we can use rowHtmlOptionsExpression
I noticed that the latest version of slick-grid has a 'headerCssClass' attribute on the column, which would work great, except I am restricted to using slick-grid version 1.4.3.
I am extending slick-grid so as to add multiple column sort functionality and will need to set the class of each sort header accordingly. So, to re-iterate the question, does anyone know of a way to dynamically change the class of any given header in slick-grid 1.4.3?
I don't really love this solution, as it is not preferred to use JQuery to modify the slick-grid, but here goes:
var headers = $('.slick-header-columns').get(0).children;
remove any non-default class information from all the headers(i.e., $(headers).removeClass('slick-header-column-sorted'))
iterate through the columns of the slick-grid and use JQuery to add a class at the wanted column index
var header = headers[wantedColIdx];
$(header).addClass('yourClass');
I think you can do this with jQuery.
Add a blank css class with some name.
Then you can call addClass and removeClass to change the class dynamically.
http://api.jquery.com/addClass/
http://api.jquery.com/removeClass/
i.e.
jQuery('.my-class').addClass('new-header-class');