0

Is there a way in IE to disable cell input inside grid and change it's color (so it won't be gray)?

Or Is there another way to disable an input - and not by changing it to "readonly"?

UPDATE: I'm using inline editing , and my cell input is a regular simple input (editable:true, edittype:'text'). I want this input to be disabled but to changed it's text color to black when it is disabled.

Thank's In Advance.

user590586
  • 2,960
  • 16
  • 63
  • 96
  • Could you explain more exactly what kind of "cell input inside grid" you mean? Do you use and editing mode (cell, inline or form editing)? Which color you mean? The color of the text? The background color? I am just not understand which scenario you mean in the question. – Oleg Mar 15 '11 at 12:40

1 Answers1

1

The answer how to change the editable attribute temporary for some column before stating of editRow. In the way no input element will be created and you will not have toe problem which you try to solve.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • @Oleg: thank's , it's works , but the problem is that i want the cell to be shown in edit mode and not diffrent from all other cells inside my row. Is that possible? – user590586 Mar 15 '11 at 13:17
  • @user590586: To tell the truth I don't understand why you want the show the user that the field is editable, but he/she can't do this. I don't know the environment. Now back to the question. In the same way as I set `editable:false` in the example you can set any option of the column. You can additionally make any changes on the DOM element of the `input` element inside of `dataInit` event (see the `editoptions`). You can change the color or background color make element disabled and so on. You should just be able to define `input` field which you need outside of the grid and do the same. – Oleg Mar 15 '11 at 14:23
  • @Oleg: thank's but i didn't quite understood your answer.. Is it possible to block only the rows that came from the server when loading the grid , and in all the new rows cancel the block so it will be editable cell? in the example you attached it's form editting, and i'm using inline editing... – user590586 Mar 15 '11 at 17:21
  • @user590586: what I meant is that one have the DOM element on the `` element as the `elem` parameter of `dataInit: function(elem){...}`. So if you don't want just make the cell no-editable setting `editable:false` before the `editRow` you can change **any** attributes of `` element by changing attributes of `elem` inside of `dataInit`. You should just define more clear what you want. For example you can set it disabled with `$(elem).attr("disabled",true);`, change background color with `elem.style.backgroundColor="red";` and so on. But I don't know **what you want**? – Oleg Mar 15 '11 at 17:32
  • @Oleg: thank's.. at first i wanted to know exactly what i worte in the question - if i'm using $(elem).attr("disabled",true); is there a way to change it's text color to black? i think all the comments are like [this question](http://stackoverflow.com/questions/5311786/jqgrid-change-cell-input-to-readonly-after-grid-loaded). so i'm going back to the original question here.. – user590586 Mar 16 '11 at 08:02
  • @user590586: Sorry, but I can not follow you goals. There are well-known standards. [Here](http://www.w3.org/TR/html4/interact/forms.html#adef-disabled) is defined what means disabled input. How I understand you the cell should be either not editing (no `` insterted) or with **disabled** input. All other changes away from the standards will follows to misunderstanding of the meaning of the input field from the user side. – Oleg Mar 16 '11 at 09:00
  • @Oleg: I just want to know if it's possible to have a disabled input - but that it wont be grayed out ? thank's. – user590586 Mar 16 '11 at 09:22
  • @user590586: Probably yes, but to give the answer I will spend time to make the experiments. If it is interesting for you you can try to do this. I see **absolutely no sense in this**, and I don't want to make thing where I see no sense. Why one use standard controls and standard attributes like "disabled", "readonly"? Why all the attributes change controls in the way like they do? It is done so to make users of the site immediately see which control is disabled and which not. If you invest the time and make disabled control look like not disabled **your page will be bad for users**. For what? – Oleg Mar 16 '11 at 09:31
  • @Oleg: I understand your point , but this is what i was asked to do. when the inputs are disabled they are not seen clearly - this is why i want them in black. it is not that i can't use it but i just wanted to know if there is a solution for this. thank's anyway! – user590586 Mar 16 '11 at 09:50