I have a tab strip inside the details template for my grid. It works fine until I decide to group my data, when I do the details template no longer works. During my investigation it turn out that the Id of the different tab strip has been set to null, while the tab strip that I opened retains their original Id. I am not sure why details template lost reference to the Id. Here are my code below.
Creating the grid
#(Html.Kendo().Grid(Model)
.Name("ChangeLog")
.Columns(columns =>
{
columns.Bound(m => m.ChangeDate2)
.Title("Date and Time")
.ClientTemplate("<span>#= formatUtcDateToLocal(ChangeDate2 ? ChangeDate : '' )#</span>")
.Width("12%");
............................
})
.Filterable()
.Selectable()
.Sortable()
.Groupable()
.Resizable(resize => resize.Columns(true))
.ToolBar(toolbar =>
{
toolbar.Template(
#<text>
<a class="k-button k-button-icontext k-grid-excel" href="#"><span class="k-icon k-i-excel"></span>Export to Excel</a>
</text>
);
})
.Events(e => e.FilterMenuInit("resizeFilter")
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("Data", "Log")
.Data("buildParam"))
)
.DataBound("preselectCustomFilter"))
.ClientDetailTemplateId("log-details-template")
)
and this is how I define my details template
<script type="text/x-kendo-template" id="change-log-details-template">
<div>
#(Html.Kendo().TabStrip()
.Name("tabStrip_#=Id#")
.Animation(animation => animation.Open(effect => effect.Fade(FadeDirection.In)))
.SelectedIndex(0)
.Items(tabstrip =>
{
tabstrip.Add().Text("Old Value").Content("<div class='oldValue' style='height:137px;padding:10px''><span>#=OldValue#</span></div>");
tabstrip.Add().Text("New Value").Content("<div class='newValue' style='height:137px;padding:10px'><span'>#=NewValue#</span></div>");
}
)
.ToClientTemplate())
</div>
When I inspect the detail template before grouping I see that the Id is being correctly applied
<div class="k-widget k-tabstrip k-header k-floatwrap k-tabstrip-top" id="tabStrip_164317" ...>
After I do the grouping all the template not initialized before the grouping now contains null instead of the id
<div class="k-widget k-tabstrip k-header k-floatwrap k-tabstrip-top" id="tabStrip_null" ........
Any hints on what I need to do? Maybe redraw the grid?
UPDATE
Refreshing the grid via .refresh() did not work.
It was my bad. I needed a second pair of eye. I was using the wrong model. When I made the call to .Read(read => read.Action("Data", "Log") I was returning logModel which is the base model that the model I use inherits from. So on load when I was using the right model it has the Id property, but after the read I was returning the base model which did not, and that is why the Id is null. :D
Related
When a custom attribute is set on a user from googles admin page I am unable to see it in their Google_Service_Directory_User object the client has this scope and is able to see the users data but no attributes are shown.
$client->setScopes(
[
Google_Service_Directory::ADMIN_DIRECTORY_USER_READONLY,
Google_Service_Directory::ADMIN_DIRECTORY_GROUP_READONLY,
]
);
I would have expected it to be in the customSchemas but that is null for all the users
When requesting user's informations, you need to set the projection parameter to FULL when using the method users.get (projection parameter is also avaible with method users.list). Default settings to not return custom schemas. You can have more informations here (Google documentation).
You seem to be using PHP (I've never coded in PHP so I may be wrong), so the request should look like this:
$optParams = array(
'userKey' => 'my_customer#example.com',
'projection' => 'full', // or maybe 'FULL' ?
);
$results = $service->users->get($optParams);
If you only want the return some of the schemas, then use :
$optParams = array(
'userKey' => 'my_customer#example.com',
'projection' => 'custom', // or maybe 'CUSTOM' ?,
'customFieldMask' => 'A comma-separated list of schema names'
);
$results = $service->users->get($optParams);
Right now in opencart the system is limited to only showing 2 levels of categories. Does anyone know of a class to get all sub-categories and a full ul li tree?
For example: If you have ever used oscommerce it will show the full tree of sub-cats in the side category menu where as opencart is limited to only two levels.
The default code is like
$categories = $this->model_catalog_category->getCategories(0);
foreach ($categories as $category) {
$children_data = array();
if ($category['category_id'] == $data['category_id']) {
$children = $this->model_catalog_category->getCategories($category['category_id']);
foreach($children as $child) {
$filter_data = array('filter_category_id' => $child['category_id'], 'filter_sub_category' => true);
$children_data[] = array(
'category_id' => $child['category_id'],
'name' => $child['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''),
'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])
);
}
}
However it only goes two levels, I am looking for all levels to build out an accordion menu.
Further I am not looking for someone to do this, (unless you want), but maybe you can point me in the right direction or to an existing class that will achieve this.
You'll need to add each sub-level manually for a 3rd, for a 4th etc. There is no way to just get all of them in one shot.
There was an older stackoverflow thread with a solution on how to add a 3rd level. Perhaps it will work with your version of OC:
get third level category in opencart 2
You basically will need to edit the controller and tpl files for category. If that's too much for you, they sell an extension on their marketplace for it, too.
I have an APEX page with a few select lists, using collections to save and refresh the page. The "System" select list is dependent upon the "Brand" selected value. I have the page working how I want, but it requires the page to be submitted after a "Brand" value is chosen so that the "System" lov is properly populated.
I am trying to make it so that when the "Brand" value is changed or selected, the "System" lov is changed immediately without needing a page submit. I've been reading and it seems you need to use jQuery and AJAX callback, but I just cannot get my head around that and make any progress.
Hoping someone can help me. I am certainly a rookie with web coding in general.
Added: my local APEX version is 5.0.3.
https://apex.oracle.com/pls/apex/f?p=4550
Workspace: UNCLE_BUCK_WS
User: developer1
Pwd: developer1
Application 83513 - Tooth Selector
Page 5: Page that works using submit page
Page 6: Page I started trying to use jQuery, but did not get very far
Added:
There is no cascading LOV for manual tabular form. See my region definition below. Hoping someone can still help, maybe copy my page and make the required changes.
select apex_item.select_list_from_query(p_idx => 1,
p_value => n001,
p_query => 'SELECT tooth_number display_value, tooth_number return_value FROM psp_teeth WHERE tooth_numbering_method = :P5_TOOTH_NUMBER_METHOD
ORDER BY tooth_number',
p_null_text => '- Choose Tooth -')
|| apex_item.hidden(p_idx => 50, p_value => seq_id) Tooth_Number
, apex_item.select_list_from_lov(p_idx => 10, p_value => c001, p_lov => 'BRAND', p_null_text => '- Choose Brand -') brand
, apex_item.select_list_from_lov(p_idx => 12, p_value => c002, p_lov => 'TYPE', p_null_text => '- Choose Type -') type
, apex_item.select_list (p_idx => 14,
p_value => c003,
p_list_values => CASE c001
WHEN 'BRAND_A' THEN 'SYSTEM_A1,SYSTEM_A2'
WHEN 'BRAND_B' THEN 'SYSTEM_B1,SYSTEM_B2'
END,
p_show_null => 'YES',
p_null_text => '- Choose System -') system
, apex_item.checkbox2(p_idx => 16, p_value => seq_id, p_checked_values => CASE c004 WHEN '1' THEN seq_id END) delete_row
from apex_collections
where collection_name = 'TEMPCOL'
Don't use tabular forms, they are archaic! Use an Interactive Grid instead, which supports cascading LOVs declaratively (you don't need to write any code, just specify that column TYPE cascades from column BRAND):
See page 9 in your app where I have created one (I didn't bother creating the master region). My LOV definition for TYPE is a bit cumbersome, you may be able to improve on that (i.e. get back to the "dynamic static" LOV that you had before).
My app allows the users to manage their documents. When creating one, a user has to either enter the document content manually or select a file from their computer (which would convert many formats to HTML for the user).
Currently, I have a simple FileUploaderView which is basically an <input type="file"> that listens to file changes, and updates the value property of the view with an object like { file: { type: SOME_TYPE' }, content: SOME_CONTENT }.
Then, DocumentsNewController listens to changes in it and converts supported files to HTML, and puts the result into the document body.
However, doing it this way feels simply wrong and does not allow for simple reuse (which I want to be able to do).
App.DocumentsNewController = Ember.ObjectController.extend
# ... stuff ...
handleDocumentUpload: (->
doc = #get 'documentUpload'
return unless doc
Ember.run =>
#set 'uploadError', false
#set 'unsupportedFile', false
#set 'processingUpload', true
type = doc.file.type
text = ''
try
if type.match /^text\//
text = doc.content
# Convert new lines to br's and paragraphs
text = '<p>' + text.replace(/\n([ \t]*\n)+/g, '</p><p>').replace('\n', '<br />') + '</p>'
else if type == 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
text = new DOCX2HTML(doc.content).convert()
else
#set 'unsupportedFile', true
catch error
#set 'uploadError', true
finally
#set 'text', text
Ember.run => #set 'processingUpload', false
).observes 'documentUpload'
And the template is something like
... stuff ...
{{view App.FileUploaderView valueBinding="documentUpload" accept="text/*"}}
What would be the proper way to refactor file converting stuff out of the controller?
I want to be able to do something like:
{{documentHandler resultBinding="documentUpload"}}
and in controller
App.DocumentsNewController = Ember.ObjectController.extend
# ... stuff ...
handleDocumentUpload: (->
if doc = #get 'documentUpload'
#set 'text', doc
).observes 'documentUpload'
My first thought was to make a DocumentHandlerView which would display the input field, show the spinner, show the errors, parse the document and assign the result to result (and since controller's template has resultBinding="documentUpload", the HTML would trigger the controller's observer).
Using a view for that would allow for easier reuse but I still feel it's not the view's job to parse the document.
Is there a better way?
After reading closely your question the best thing that comes in mind would be to create a Ember.Mixin and then use it for all the controllers that need the same functionality.
Example taken from the ember API docs:
App.Editable = Ember.Mixin.create({
edit: function() {
console.log('starting to edit');
this.set('isEditing', true);
},
isEditing: false
});
// Mix mixins into classes by passing them as the first arguments to
// .extend.
App.CommentView = Ember.View.extend(App.Editable, {
template: Ember.Handlebars.compile('{{#if isEditing}}...{{else}}...{{/if}}')
});
commentView = App.CommentView.create();
commentView.edit(); // outputs 'starting to edit'
The example is only conceptual, but it will be easy to create a mixin yourself and put all the common logic in there.
Hope it helps.
Inside the template account_new_confirmation, which is the template of the confirmation mail the user receives after he creates a new account, I need to add a param inside the tag
{{store url="customer/account/confirm/" _query_id=$customer.id _query_key=$customer.confirmation _query_back_url=$back_url _query_myparam="TEST"}}
this is working for a string producing the following link to be written inside the confirmation mail as expected:
http://baseurl/customer/account/confirm/?id=12345&key=donkey&back_url=monkey&myparam=TEST
but I cannot figure out how to replace the string TEST with the value of a param I have in request post.
I mean the user reach this point after having filled a form sent with POST action. Inside this form I have a checkbox named FOO and I need to add its value (true or false) to _query_myparam on my example above.
I tried with
_query_param=$foo
and with
_query_param=$this->getRequest()->getPost('foo')
but they both were too easy to work.
Anyone knows how to solve this?
I found it myself :D
You have to change the method sendNewAccountEmail of the class Mage_Customer_Model_Customer which you can find in app/code/core/Mage/Customer/Model/Customer.php
You need to add new variables available inside the template inside:
array('customer' => $this, 'back_url' => $backUrl)
So for your need this would be changed in:
array('customer' => $this, 'back_url' => $backUrl, 'foo' => Mage::app()->getRequest()->getPost('foo'))
Then you can add this variable to the template param as
{{store url="customer/account/confirm/" _query_id=$customer.id _query_key=$customer.confirmation _query_back_url=$back_url _query_myparam=$foo}}
This will produce the following link:
http://baseurl/customer/account/confirm/?id=12345&key=donkey&back_url=monkey&myparam=on
when checkbox FOO is checked.
Thanks