Sencha Touch: Clear listeners on an individual list item - sencha-touch

In a TreeStore I have a list item / record which differs from all the other records. I want to execute window.open() whenever the user clicks on this specific record. The other records should maintain their usual functionality. (leafItemTap => detailCard)
I have tried all events of NestedList that made sense to me but no success.
My basic idea is to clear all listeners on the list item and add a custom one for the window.open() task.

Try to use select event, it's preventable so you just need to return false. However, you need to do extra work to deselect previously selected item:
http://docs.sencha.com/touch/2.3.1/#!/api/Ext.dataview.List-event-select

Related

How can I create internal user using my custom module in odoo15?

I don't want to use 'users' menu item and want to manage users from another menu item named 'Merchant' and only a specific user group data will be there and while creating new record I want to set a specific user_group. Is there any approach for that?
You can simply add the menu directly under your module. Get the menu for res.users and put where ever you want. Don't forget to add dependency to base.
While doing that you can add a domain to the menu item and filter according to your needs.
Also put that domain into the context of the menu with giving a default value same as the domain. That is, you need to put the required settings in the context like {default_FIELD_NAME: VALUE}. You need to use the default_ prefix for it to work. That way when creating a new user from your menu the context will get the default value and set accordingly. However, if it is not a readonly field, user may change the value. There are two ways to avoid that:
i. create your own form using the res.users and design it the way you like it with default values.
ii. inherit the view of res.users and change the related field to be readonly if a certain context value is passed. Then you can call the view with context let's say {readonly_group_x: True} and it should work. Also you may need to make sure that force_save="1" is set since it may not save the readonly field.
These are the basic steps of accomplishing what you have described. However, working with res.groups can be challenging depending on what you want to do. You may need to tweak or even end up creating your own view with the desired effect.

ListView with backward forward navigation and limited elements

In Sencha, how to create a DataView or List component which renders only 1 item at a time and contains prev/next buttons to navigate data?
Store has pagination enabled to pull only 5 records at a time. Out of these 5 records I want to display only 1 record at a time on the view and with navigation buttons to move forward/backwards. Is there a built-in component for this requirement?
I see few SO posts (Sencha Touch limit number of items in list) suggesting to use 2 stores (DisplayStore to slice the actual data). This didn't work for me. I tested this with static data in the actual store. It still renders all the data in the list. Moreover I am looking for forward/backward navigation buttons too.
If there is no such built-in component (at least close enough), I want to create one for my needs. Please suggest.
You should go with a filter, and two buttons.
The handler for the next button could be alike
var number= list.getStore().first().getId()
list.filter('id', number+1)
If there is anyway to increase a number for the next valid item. Otherwise you need a counter of your current selected item and increase that.

Add Control after Items in GridView Group

I'm currently developing a Windows 8 Store app that uses a Grouped GridView in the HubPage showing Highlights for some Categories. So far, when clicking the Header you see More Highlights for this Category.
Now i want to add a control at the end of every Group leading the User to the "non-highlight" Category site, where just all the Items of this category are displayed.
Is there an easy and elegant way to do this - propably with a Template is suppose.
( i think the latest Bing-News-App has a similar feature )
Thanks in advance for every help.
There are a couple of ways you can do this.
You can add an arbitrary object to the end of your group, then use a DataTemplateSelector to style it.
You can create your own VariableSizedWrapGrid with the control added to the end in the constructor (slash "Arrange"). You can then add an arbitrary click handler as a dependency property and only show the button if the click handler is set, so you can reuse this on other pages, etc.
You can change the GroupStyle to include something similar at the end of the group, but it likely won't animate with the other items in the group (if that's important to you).
The easiest one to do is probably the first one. If your group is a list of SampleItems then make a subclass of the SampleItem class called something similar to TerminalSampleItem. Create a template for it (like you've made other data templates). Make an ItemTemplateSelector that has two properties, NonTerminalDataTemplate and TerminalDataTemplate (assuming you only have two data templates). Have the SelectTemplateOverride function check for (item is TerminalSampleItem);

How to build autocomplete similar-title check like stackoverflow?

Using Yii PHP framework. When you ask a question on stackoverflow, as you type the title a list appears called "Questions that may already have your answer". I want to create similar type of field so that when users enter the name of a business I can display similar business names already in my system. It doesn't necessarily need to be as sophisticated as stackoverflow's model. A simple alphabetical search should be fine.
Keep in mind unlike a normal autocomplete, this "autocomplete" won't actually fill in the field in question but rather serves as an informational tool to inform the user of data that potentially already exists.
I'm thinking Yii CJuiAutoComplete widget is the right tool for the job but how do I dissociate the autocomplete from the input field?
CJuiAutoComplete is definitely the right tool, and to disable the auto filling when selecting the suggested values, you will have to alter jQueryUI autocomplete's behavior for its select event, and also for its focus event.
The select event is triggered when a suggestion item is clicked, and focus event is triggered when a suggestion item is navigated to by keystroke (up, down arrow keys).
So to change the default behavior, which is updating the text field, you can cancel those events by returning false from their callbacks:
$this->widget('zii.widgets.jui.CJuiAutoComplete', array(
// other options
// additional javascript options for the autocomplete plugin
'options'=>array(
'select'=>'js:function( event, ui ) {
return false;
}',
'focus'=>'js:function(event, ui) {
return false;
}'
),
));

How to add grid to Extjs Form and submit its data?

I am designing a highly complex data entry form using extjs 4.0. I am binding a model to my form.
Inside my model I am having a property say "Products" which represent the Product model. Now I want to show these products in Grid on my form Panel. User can add remove the products from the grid and save the form.
What is the best way to achieve this ?
If I understood you correctly you have a 1 to Many association of objects where the 1 side is loaded into a form for editing and the Many need to also be show but in a grid within the form.
The way I approached a similar design is by adding a gridpanel below the form. In my case there were other components so my grid was wrapped in a tabpanel. Similar to this example see form 5.
Now, what goes in the grid? Well I added a store representing my Many objects - or Products for your example. I setup a writer proxy for that store and added a roweditor plugin to the grid. The end result was an easy way for users to manage the relationships, edit properties of both parent and children objects all from one screen. I chose to have an autosync store for the Many store, but you dont have to. You can easily add a save button to the grid, or just bind the action to the parent's Save button.
Hope this get's your creative juices flowing :)
You could overwrite setValues(), getValues() methods of your form. Just add grid binding to the base methods. Note - no need to extend the form to create your own class. You could overwrite these functions right where you declare the form.
{
xtype: 'form',
setValues: function(){}
}
Hope this helped.