PDA

View Full Version : Remote combobox in ext js grid v 4.2 (single/ multiple selection)



shakerkk
4 Sep 2015, 10:19 AM
Hello everyone,

I just want to ask if is possible or if someone found a solution for a remote combo box that is rendered in Grid , and also can support multi selection.

I have a really hard time to find a solution . And nothing comes in to my mind.

Thanks .

joel.watson
4 Sep 2015, 10:56 AM
Hi--

You should be able to do this as a cell editor. Here's an example in the docs:
http://docs.sencha.com/extjs/4.2.1/#!/example/build/KitchenSink/ext-theme-neptune/#cell-editing

(it's not a remote combobox, but the principle would be the same)

Thanks!
Joel

shakerkk
4 Sep 2015, 11:30 AM
Well , i saw the example but , i have a lots of problems like , my values for the grid are coming something like:

col10{
title:
value:
}
and on the column i have something like the example you gave me :


{
header: 'Example',
dataIndex: 'col10',
width: 130,
editor: {
xtype: 'combobox',
requestUrl: 'url'
},
xtype: 'columntemplate',
tpl: {col.10.title}
}

But when i`m trying to click and edit i have problems like : in the combobox [Object Object];

joel.watson
4 Sep 2015, 11:32 AM
Hi--

Can you share an example that demonstrates the issue: https://fiddle.sencha.com

Thanks!
Joel

shakerkk
4 Sep 2015, 11:36 AM
Well now i'm trying to make one in fiddle but will take some time .

shakerkk
4 Sep 2015, 12:52 PM
Hello-

I managed to make something :)

https://fiddle.sencha.com/#fiddle/tdh

shakerkk
7 Sep 2015, 1:09 AM
Please if someone have an ideea how to handle this , i`ll be very grateful .

f.baron
7 Sep 2015, 3:29 AM
The easiest way to work with extjs4 cell/row editing is to use the same "id" as column data and editor combo value field.
If you can't edit your JSON you could create a custom "emailValue" field in your model. Here is the updated fiddle:

https://fiddle.sencha.com/#fiddle/ter (https://fiddle.sencha.com/#fiddle/ter)

shakerkk
7 Sep 2015, 3:42 AM
I like how it works but do you think is possible when you have a remote combobox ?

f.baron
7 Sep 2015, 4:56 AM
I like how it works but do you think is possible when you have a remote combobox ?

Oh yes! It should works with remote store too.

shakerkk
7 Sep 2015, 5:31 AM
Can you help me with a fiddle because now i`m trying to make one and i fail when my store is remote the combobox shows me just the value ..so its a bit strange.:(

f.baron
7 Sep 2015, 6:35 AM
When do you load the store? Are you using editable/autocomplete store?

If your store is empty until user start typing in the combo, you could add a "beforeedit" listener that simply add to the store the record to select on the combobox.
Something like:


beforeedit: function(editor, context) {
if (context.field === 'emailValue') {
var email = context.record.get('email');
if (email) {
context.column.getEditor().getStore().add(email);
}
}
}

shakerkk
7 Sep 2015, 6:42 AM
My store is loading when i expand the combobox.....

f.baron
7 Sep 2015, 6:48 AM
It should work... have you verified that a record with the email value of the row is returned by the remote load?

shakerkk
7 Sep 2015, 7:06 AM
Mann you are the BOSS :)) i`m very glad that is working properly :) you gave me hope :)

Now all is working in fiddle now i some how try to get rid of that emailValue and to work without convert...:-? but i think that will take a lot of time :)

shakerkk
7 Sep 2015, 7:33 AM
Also have a bug for example when you select something in combobox then select again , add each time in the store but i thing i have to make a verification.

shakerkk
8 Sep 2015, 4:30 AM
Hey Baron, how can i get rid of that convert ...cause its causing me a lot of trouble.

f.baron
18 Sep 2015, 2:44 PM
Hey Baron, how can i get rid of that convert ...cause its causing me a lot of trouble.

Try


{name: 'emailValue', mapping: 'email.value'}